views:

51

answers:

0

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 version 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?