I'm not really familiar with the connection protocols.
I'm using the following code to examine connect() so I can get the hostname:
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif
int error;
char hostname[NI_MAXHOST] = "";
error = getnameinfo(serv_addr, addrlen, hostname, NI_MAXHOST, NULL, 0, 0);
if (error !=0) {
ALogTCP(@"coudldn't resolve hostname or internal connect");
[pool release];
return orig__connect(sockfd, serv_addr, addrlen);
}
if (error == 0) {
ALogTCP(@"hostname: %s", hostname);
NSString *hostFirst = [NSString stringWithCString:hostname];
}
can I use the "same" code to get the hostname if I hook into sendto() (so I can examine UDP)?
thanks in advance.