Skip to content Skip to sidebar Skip to footer

Connecting Python Socketserver With C# Client

I am trying to send data to Python via C# client. My code works when both the server and the client is either Python or C# but when I run the same code with C# client and Python se

Solution 1:

I was able to resolve this issue by changing

IPAddressipAddress= ipHostInfo.AddressList[0];

to

IPAddressipAddress= ipHostInfo.AddressList[2];

It turns out AddressList[0] returns IPv6 Address and in Python socket.gethostname() returns IPv4 address.

Solution 2:

IPAddressipAddress= ipHostInfo.AddressList[1];

works for me.

Solution 3:

server trying to read 1024 byte from client when message received.

`self.request.recv(1024).strip()` 

client message size is not 1024 byte, try use public byte[] buffer of StateObject in Send Method.

Post a Comment for "Connecting Python Socketserver With C# Client"