I've looked up stuff regarding winsock. I'm not sure what is used internally for networking in GLBasic, but Winsock seems to output a structure after receiving a UDP message which contains info (the 'recvfrom' structure is a 'sockaddr' structure, see
http://msdn.microsoft.com/en-us/library/ms740496%28v=VS.85%29.aspx, which contains the IP address).
The 'recvfrom' function seems to be used in UDP (it says it is used for connectionless receiving) - see
http://msdn.microsoft.com/en-us/library/ms740120%28v=VS.85%29.aspxThis function outputs a sockaddr structure:
int recvfrom(
__in SOCKET s,
__out char *buf,
__in int len,
__in int flags,
__out struct sockaddr *from,
__inout_opt int *fromlen
);
The 'recvfrom' function, or something similar seems to be used in GLBasic. This function takes in a previously setup socket, a pointer to a buffer, a maximum length to read - sounds like the the GL function:
SOCK_RECV(sock%,msg$,length%)
Anyway, if GLBasic does use Winsock, then the IP address from a received UDP message should be put in the specified 'sockaddr' structure. However, I'm assuming it's probably a lot more complicated than that -
Winsock doesn't exactly sound like a multiplatform thing

I think that the majority of this post will probably be useless if GLBasic doesn't use winsock, and possibly if I've misunderstood stuff about winsock, but here are some links which should be relevant in any case:
The structure of 'pseudoheaders' - the source IP is included.
http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_PSEUDO-HEADERIf you scroll down to the section on UDP, you can see that there is a normal header, followed by the pseudoheader described in the wikipedia page (i think at least).
http://www.protocols.com/pbook/tcpip2.htmAnother link on the normal header and then IPv4 and IPv6 pseudoheaders.
http://www.networksorcery.com/enp/protocol/udp.htmEDIT: The links posted by Ocean and Moru also have this, I didn't notice until now
