T
Tim Veldhuizen
Hi all!
I'm attempting at writing a networked program. It is going to be a threaded
irc server in c++ using almost nothing but oop code.
And it needs to know the full hostname of the users that connect to it. I
already get some info from this code:
workersock = accept(mastersock, &sockaddr, &addrlen);
printf("Received a Client Connection from: %s port: %d fd: %d\n",
inet_ntoa(sockaddr.sin_addr), ntohs(sockaddr.sin_port), workersock);
But it also needs to get the hostname resolved.. Something like 127.0.0.1
would resolve to localhost.localdomain but for every possible ip (if there
is a dns that knows the hostname ofcourse)
I don't mind if the command or routine would take some time, becouse it is
going to work from within a thread either way.. (It would have to be thread
safe too then i guess)
I've searched google for it and looked through some groups, but can't seem
to find it.
Any help is more than welcome. Tnx in advance..
Tim.
I'm attempting at writing a networked program. It is going to be a threaded
irc server in c++ using almost nothing but oop code.
And it needs to know the full hostname of the users that connect to it. I
already get some info from this code:
workersock = accept(mastersock, &sockaddr, &addrlen);
printf("Received a Client Connection from: %s port: %d fd: %d\n",
inet_ntoa(sockaddr.sin_addr), ntohs(sockaddr.sin_port), workersock);
But it also needs to get the hostname resolved.. Something like 127.0.0.1
would resolve to localhost.localdomain but for every possible ip (if there
is a dns that knows the hostname ofcourse)
I don't mind if the command or routine would take some time, becouse it is
going to work from within a thread either way.. (It would have to be thread
safe too then i guess)
I've searched google for it and looked through some groups, but can't seem
to find it.
Any help is more than welcome. Tnx in advance..
Tim.