For some reason this seems like something hard to do, a google search on this reveils lot of forums where peopled asked this same question but got a useless, or no answer. I found stuff on MS, but that won't help.. this is linux sockets.
I assume it has to do with the structure or something so here's the accept part of the code since some of those vars probably need to be used somehow, not even sure if those are predefined, or if they can change.
I assume it has to do with the structure or something so here's the accept part of the code since some of those vars probably need to be used somehow, not even sure if those are predefined, or if they can change.
Code:
clientAddressLength = sizeof(clientAddress);
connectSocket = accept(listenSocket,(struct sockaddr *) &clientAddress,&clientAddressLength);
if (connectSocket < 0) {
NSS_logger("cannot accept connection ",2);
exit(1);
}
cout<<inet_ntoa(sockaddr.clientAddress);//my failed attempt