Simple Socket Server-One Client communication - Python -


i having problems code in simple one-client -- server communication. running local machine (desktop pc) seems run fine, but, when used desktop server , laptop client getting winerror 10061... "no connection made because machine actively refused it"

i followed advice other questions here , this question , here still have questions.

code below:

server:

import socket s = socket.socket(socket.af_inet, socket.sock_stream) s.bind(("myipaddress", 4000)) s.listen(5) . . . #rest of code 

client:

  import socket   s=socket.socket(socket.af_inet, socket.sock_stream)   host = "myipaddress"   s.connect((host, 4000))   .   .   . #rest of code 

what want server detect , bind client's ip address, , client connect server without having specify ip address. possible? worked following ways:

  1. putting in bind (server.py) , connect(client.py) ip address.
  2. putting ip address in client , using socket.gethostname() in server

it didn't work with: binding , connecting '0.0.0.0'. still got error 10061. member polynomial in here, gave pretty undestandable explanation, didn't work me , have yet grasp idea of how leave socket accessible all. same goes when entering '127.0.0.1' address. doing wrong?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -