연결되어 있는지 확인하려면 어떻게해야 자기 설명이다 다음 코드 :파이썬 - 소켓이 여전히
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host, port)
s.send("some data")
# don't close socket just yet...
# do some other stuff with the data (normal string operations)
if s.stillconnected() is true:
s.send("some more data")
if s.stillconnected() is false:
# recreate the socket and reconnect
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host, port)
s.send("some more data")
s.close()
내가 s.stillconnected()
내가 맹목적으로 소켓을 다시하지 않으 구현하려면 어떻게합니까.
좋은 직장 +1하지만 여기에서 귀하의 현상금에 대한 의견을 참조하십시오 : https://superuser.com/questions/955266/prevent-windows-7-sleep-while-files-are-being-accessed-by-network 및 let 그 의견에 도움이 될만한 것이 있다면 나도 알아. –