地址问题python网络编程地址问题
s.getsockname()s.getpeername()
getsockname: Return the address of the local endpoint.? For IP sockets, the address info is a pair (hostaddr, port)
????getpeername: Return the address of the remote endpoint.? For IP sockets, the address info is a pair (hostaddr, port).
?
????
Socket的异常????
与一般I/O和通信问题有关的 socket.error与询查地址息信有关的 socket.gaierror与其他地址错误有关的 socket.herror与在一个socket上调用settimeout()后,理处超时有关的socket.timeout????用使connect()的调用的时候,序程可以处理把主机名转换成IP地址的问题,若主机名不对会发生socket.gaierror,若连接远程主机有问题,会发生socket.error。
文章结束给大家分享下程序员的一些笑话语录: 真正的程序员喜欢兼卖爆米花,他们利用CPU散发出的热量做爆米花,可以根据米花爆裂的速度听出正在运行什么程序。