python - ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host -


i beginner in python programming socket. now, have problem error

data, address = s.recvfrom(max) connectionreseterror: [winerror 10054] existing connection forcibly closed remote host 

the following code:

import socket, sys s = socket.socket(socket.af_inet, socket.sock_dgram)  max = 65535 port = 1060  = raw_input()  if == "server":     s.bind(("127.0.0.1",port))     print("listening @ ", s.getsockname())     while true:         data, address = s.recvfrom(max)         print("the client @ " + str(address) + " says " + repr(data)) elif == "client":     s.sendto("this message".encode(), ("127.0.0.1", port))      print("address after sending: ", s.getsockname())     data, address = s.recvfrom(max)     print("the server " + address + " says " + repr(data)) else:     print(sys.stderr) 

after run program , enter "client" input, cause error. thank answer. ;)

run server , client on same time :)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -