Hi guys,
The program is listening to the UDP socket. After receiving datagram it
it should
determine sender address, but it always is "0.0.0.0". If I sent datagram
using the same sockaddr_in structure, it goes to the localhost.
I use gcc 2.95 on Sparc Ultra5 with Solaris 2.6.
Part of code:
*********************************************
struct sockaddr_in from;
......
if ((len = recvfrom(fd, buf, size, 0, (struct sockaddr*) &from,
&addrLen)) < 0)
{
return -1;
}
else
{
/* print 32-bit binary address in ascii format */
printf("addr=%s\n", inet_ntoa(from.sin_addr));
.....
}
*********************************************
The same code works perfectly on Intel with RedHat6.1, so
it prints real address of the sender.
Did I make mistake somewhere, or is it Solaris feature?
Any help welcome!
Alex