There is also the possibility to use the getpeername() function
on a connected socket.
Here are some pieces of code:
struct sockaddr_in addr;
int address_size;
address_size = sizeof(addr);
if(getpeername(sd, addr, address_size) != -1)
{
Hi,
so the question is: when Server accepts client connection, do he get IP
address of the client for further correspondence. If not how can I get IP
address of the client connecting to my server? and if yes from where can I
print out client IP address?
thankx
MI
See the demos section in openssl-0.9.7d/demos/ssl/serv.cpp.
This is UNIX oriented answer there is a struct
struct sockaddr_in sa_cli;
that is defined in
struct sockaddr_in {
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
unsigned