客户端:
print s.getsockname()
返回scket自己的地址
print conn.getpeername()
返回socket连接的远程的地址
import socket
import time
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("192.168.137.2",8080))
#print s.getsockopt()
print s.getsockname()
#s.sendall("this is shutdown test" + "
")
s.send('test111111111111111111111121')
print dir(socket.herror)
#print dir(socket.herror)
# s.shutdown(socket.SHUT_RDWR)
#s.shutdown(socket.SHUT_RDWR)
print(socket.SHUT_RDWR)
print(socket.SHUT_RD)
print(socket.SHUT_WR)
print s.recv(5)
客户端定义了buffer为5,那么只收到5个长度的返回