Socket error 10058 – Cannot send after socket shutdown //socket已经关闭

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__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'errno', 'filename', 'message', 'strerror']
2
0
1
Traceback (most recent call last):
  File "C:/Users/TLCB/PycharmProjects/untitled2/http/t5.py", line 21, in <module>
    s.send('8888777')
socket.error: [Errno 10058] 


关闭socket后无法发送数据


Socket error 10058 – Cannot send after socket shutdown //socket已经关闭 

 

Socket error 10058 – Cannot send after socket shutdown //socket已经关闭Socket error 10058 – Cannot send after socket shutdown //socket已经关闭 zhaoyangjian724 发布了3775 篇原创文章 · 获赞 113 · 访问量 349万+ 他的留言板 关注
上一篇:BZOJ 4199: [Noi2015]品酒大会 后缀自动机_逆序更新


下一篇:多线程