Reputation: 233
Client Codes:
fwd = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
fwd.connect((oriIp,oriPort)
fwd.close()
I found the close() function did not work. My server (c#) shows the connection still alive. Until the python script is closed , the server will show the state of connection is closed.
I use IronPython 2.7.
Upvotes: 1
Views: 4608
Reputation: 37661
See python docs for socket:
Note: close() releases the resource associated with a connection but does not necessarily close the connection immediately. If you want to close the connection in a timely fashion, call shutdown() before close().
https://docs.python.org/2/library/socket.html
Upvotes: 3