Tech Support > Computer Hardware > Microprocessors > UDP socket loopback problem while IP != 127.0.0.1
UDP socket loopback problem while IP != 127.0.0.1
Posted by Alex Vinokur on April 22nd, 2006


=====================
RTOS - INTEGRITY
Target - PowerPC 8260
Target IP Address - 10.1.1.1
Host: Microsoft IP Professional
Host IP Address - 10.1.1.75
=====================

-----------------
UDP Sockets
-----------------

socket1: ip1, port1 // on Target
socket2: ip2, port2 // on Target
socket3: ip3, port3 // on Host


ip1 == ip2
port1 != port2

ip1 != ip3 // ip3 == 10.1.1.75

----------------------------------
From Target to Target
sendto () // From socket1 to (ip2, port2) - Target
recvfrom() // On socket2 - Target
---------------------------------

Situation 1. ip1 == ip2 == 127.0.0.1 (The standard IP address used for a loopback network connection)
It works fine.
A message has been sent by using sendto() via socket1,
and it has been received by using recvfrom() via socket2.


Situation 2. ip1 == ip2 == 10.1.1.1 (Target IP Address)
It doesn't work.
A message has been sent by using sendto() via socket1,
but recvfrom() is waiting for a message (blocked) via socket2.
--- What could be reason for that?
--- Problem with a DNS server?


Additional information.
1. gethostbyname() doesn't work on the target, i.e., doesn't produce its IP Address 10.1.1.1

2. Similar UDP socket loopback program works fine on PC:
http://groups.google.com/group/sourc...7ac225df49fd36
http://groups.google.com/group/alt.s...4fc3a3f2ba5fa2

3. Target -> Host
----------------------------------
From Target to Host
ip1 = 10.1.1.1; ip3 = 10.1.1.75
sendto () // From socket1 to (ip3, port3) - Target
recvfrom() // On socket3 - Host
---------------------------------
It works fine.
A message has been sent by using sendto() via socket1,
and it has been received by using recvfrom() via socket3.

4. The question was asked on news:comp.unix.programmer in thread
http://groups.google.com/group/comp....950f5de25285d9
about a month ago too.

--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn



Similar Posts