getpeername() Retrieves the name of the peer connected to the specified socket.
getsockname() Retrieves the local address to which the specified socket is bound.
getsockname() Retrieves the local address to which the specified socket is bound.
int nCount = 0;
char name[255];
if( gethostname ( name, sizeof(name)) == 0)
{
PHOSTENT hostinfo;
hostinfo = gethostbyname(name);
for(int i = 0; hostinfo!= NULL && hostinfo->h_addr_list[i] != NULL; i++ )
{
strIp[i] = inet_ntoa (*(struct in_addr *)hostinfo->h_addr_list[i]);
nCount++;
}
}