A
problem with Python and C#It's just the bikes flying on the grid. Make sure that you've all sent baytes, https://docs.python.org/3/library/socket.html#socket.socket.send I don't owe all the bikes. bytes send. Use it. socket.sendall() instead, which either sends or ends with a mistake, the only difference. socket.send()that there's no way to know how many bytes have been successfully sent error. https://docs.python.org/3/library/socket.html#socket.socket.recv returns More than ever bufsize Byte might be less likely to return.Perhaps you'd better use a higher-level library, for example. http://docs.python-requests.org/ and send the server http-requests with JSON data in format: >>> import json
>>> json.dumps((12, 4, 0))
'[12, 4, 0]'
>>> import requests
>>> r = requests.post('http://httpbin.org/post', json={"data": (12, 4, 0)})
>>> r.json() # response
{'args': {},
'data': '{"data": [12, 4, 0]}',
'files': {},
'form': {},
'headers': {'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate',
'Content-Length': '20',
...
For 4- and you have an incorrect order of Byte: the server sends big-endian as it's online, and on the client, you use the automobile order, which you have little-endian (from the junior to the high order of the bayts inside). Example (Pyton 3):>>> int.from_bytes(4 .to_bytes(4, 'big'), 'little')
67108864
The order of the Byte used in your client-server exchange protocol should be recorded:>>> import struct
>>> struct.pack('>i', 4)
b'\x00\x00\x00\x04'
>>> struct.pack('<i', 4)
b'\x04\x00\x00\x00'
The number to be recorded is that the default is again used by the platform ' s own size (which C would have used), e.g. 32 vs. 64-bit.Make sure you don't try to send a number with a sign like a number without a sign:>>> int.from_bytes((-1).to_bytes(4, 'little', signed=True), 'big', signed=False)
4294967295
Also, when the constituent objects are packaged, padding between the elements of the structure may be added if you use the platform ' s own format (default or clear indicator of format) '@') If used clearly: '!'♪ '<'♪ '>' formats, no padding.If you'd used it '!iii' format, guaranteed Regardless of the car that you started this code, that big-endian bikes, the size of each number of four bytes, every number with a sign and no padding-- https://docs.python.org/library/struct.html#format-strings : >>> struct.pack('!iii', 12, 4, 0)
b'\x00\x00\x00\x0c\x00\x00\x00\x04\x00\x00\x00\x00'
>>> _.hex()
'0000000c0000000400000000'
Make sure that C# is the one that sends these bikes. Related question: https://ru.stackoverflow.com/q/385823/23044