04-22-2014 02:01 PM
Hello,
I have a simple C++ program that interacts with a LabVIEW RT program in a CRIO 9068. The C++ code acts as a UDP server that receives data from the LabVIEW RT program on a specific port (e.g. 32000) over the loopback interface. The UDP server is "bind" to the port. When i cross-compile and run the C++ program, i noticed that the binding fails and thus the two programs could not communicate. This happens when the communication is made over the loopback interface. Otherwise, creating UDP sockets between a CRIO 9068 and another machine works fine. I verified this restriction by writing simple UDP server and client programs in C++ that communicate over the loopback interface. While these simple programs fail to communicate in CRIO 90868 Linux RT, they successfully communicate in other platforms (e.g Ubuntu).
Is this restriction on creating UDP sockets over the loopback interface purposely introduced for security reasons or have I failed to notice something else? How do I get around this restriction and make my C++ program talk to the LabVIEW RT program over the loopback interface?
Thanks!
T
04-22-2014 02:12 PM
ttesfay,
When you say the loopback interface, are you connecting to localhost and letting the local DNS entry resolve, or connecting to 127.0.0.1?
Can you try and connect via the eth0 address to see if it works? (this will help deturmine if it is specificly to the loopback interface or if it is something else).
-TD
04-22-2014 03:08 PM
Hello tduffy,
Thank you for your reply. I just found out that the problem happened because the LabVIEW RT program and the receiver C++ program were trying to use the same port number - that is why the bind failed. The LabVIEW RT implementation is not mine and i did not know that it was implemented such that both sender and receiver port numbers are the same. This is not a problem when the receiver runs in another machine. The problem manifested when I tried to run my code in the same Crio 9068 machine that runs the LabVIEW RT.
Thanks again,
T
04-22-2014 03:47 PM
Ahh, good catch! Glad you figured it out!
-TD