开发者

Why isn't the socket binding correctly in Python?

开发者 https://www.devze.com 2023-01-09 23:54 出处:网络
I have written some Python bindings for a third party library written in C++. When I use the library in Python it sends data over the network but it does not receive anything (it does both in C++). If

I have written some Python bindings for a third party library written in C++. When I use the library in Python it sends data over the network but it does not receive anything (it does both in C++). If I run the same test program in two different C++ processes it crashes because they are both trying to bind a socket to the same port.

But when I run the python version together with the C++ version this does not happen, leading me to believe that the Python ver开发者_Python百科sion is not binding the socket correctly. All the same C++ functions are being called by the Python code.

However, the Python code does get a socket binding error when run twice at the same time. I have checked that the port and address variables are the same in Python and C++ so they shouldn't be binding to different addresses. Can anyone give me an idea of what might be happening here?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号