realpython / realpython/materials
hi There, upon running the codes below, i have the problem in the last 2 lines : sock.sendto(message.format(i, time.asctime()), server_address) TypeError: a bytes-like object is required, not 'str'
未关闭
还没有人认领这个 Issue。
- 主要语言
- Jupyter Notebook
- 星标
- 5.2k
- 派生
- 5.3k
- 平均合并
- 4 天 10 小时
- 30 天内合并 PR
- 10
描述
Import Module
import socket
import time
Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Connect the socket to the port where the server is listening
server_address = ("localhost", 10000)
print('[+] Connecting to %s Port %s' % server_address)
message="Message No. {} | Sent By Client At Time {} "
for i in range(15):
sock.sendto(message.format(i, time.asctime()), server_address)
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行 issue 中显示的 UDP 套接字代码片段,并检查传递给 sock.sendto 的参数。确认该示例在没有报告的 TypeError 的情况下完成全部 15 次发送,并且其文档所述行为仍保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100