zoukankan      html  css  js  c++  java
  • 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" + "
    ")
    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:Python27python.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已经关闭 
  • 相关阅读:
    CodeForces
    [SDOI2018] 战略游戏
    bzoj3786: 星系探索
    bzoj4383: [POI2015]Pustynia
    bzoj4353: Play with tree
    bzoj4336: BJOI2015 骑士的旅行
    bzoj4381: [POI2015]Odwiedziny
    codechef January Lunchtime 2017简要题解
    bzoj 3867: Nice boat
    3069: [Pa2011]Hard Choice 艰难的选择
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348565.html
Copyright © 2011-2022 走看看