Recvfrom for UDP sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am writing a simple program in which a machine A
broadcasts UDP messages on a subnet. Another machine B
on the same subnet receives this message using
"recvfrom". 

int recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);

The last 2 parameters of recvfrom give information
about the sender of the message - machine A. The
information is IP address, port number, and family
(AF_INET etc.).
If I compile the program using gcc option -O2,
recvfrom works & receives the message correctly, but
no information about the sender. If option -O2 is not
used, this works fine.

I need to get the sender's information and also use
-O2 option for my program. Is there any other way to
do this... or am I missing any code. 
Thanks for the help.
-SP


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux