python udp socket.sendto(bytes, address)(将数据发送到套接字)

socket.sendto(bytes, flags, address)
Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by address. The optional flags argument has the same meaning as for recv() above. Return the number of bytes sent. (The format of address depends on the address family — see above.)

将数据发送到套接字。 该套接字不应连接到远程套接字,因为目标套接字是由地址指定的。 可选的flags参数与上面的recv()具有相同的含义。 返回发送的字节数。 (地址格式取决于地址系列-参见上文。)

Changed in version 3.5: If the system call is interrupted and the signal handler does not raise an exception, the method now retries the system call instead of raising an InterruptedError exception (see PEP 475 for the rationale).

在版本3.5中进行了更改:如果系统调用被中断并且信号处理程序没有引发异常,则该方法现在重试系统调用,而不是引发InterruptedError异常(有关原理,请参阅PEP 475)。

参考文章:socket.sendto(bytes, address)

你可能感兴趣的:(网络编程)