I call recvfrom, it's an UDP connection. How to get the IP address from which the packet came, out of the struct now?
Posted on 2004-08-16 04:07:29 by flapper
Fifth parameter to recvfrom() is a pointer to a sockaddr structure... so, pass a pointer to a sockaddr structure here. The sixth parameter is a pointer to a dword holding the size, so fill out a DWORD with sizeof sockaddr, and pass a pointer to the dword.
Posted on 2004-08-16 06:09:25 by f0dder
Ye I did that so far, but how can I get the IP address out of the struct now? :)
Posted on 2004-08-16 06:31:04 by flapper
Ok... first, it's smarter to use a sockaddr_in - since there isn't any HLL compiler requiring a typecast ;). Then, you should be able to find the IP in sin.sin_addr.S_addr.
Posted on 2004-08-16 07:00:00 by f0dder