import socket
import time
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("192.168.137.2",9090))
#print s.getsockopt()
print s.getsockname()
print s.getpeername()
#s.sendall("this is shutdown test" + "\r\n")
s.send('8888777')
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(90)
s.shutdown(1)
time.sleep(10)
s.send('8888777')
# while (1==1):
# print s.recv(90)
C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled2/http/t5.py
('192.168.137.1', 59470)
('192.168.137.2', 9090)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__', &#
Socket error 10058 – Cannot send after socket shutdown //socket已经关闭
最新推荐文章于 2024-02-26 23:46:33 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)