Code:
/* setup address info for our server socket */
bzero((char *)&addrServer, lenSockAddr);
addrServer.sin_family = AF_INET;
addrServer.sin_addr.s_addr = inet_addr(UPNP_SERVER_IP);
addrServer.sin_port = htons(UPNP_SERVER_PORT);
/* create our socket */
if ( UPNP_HTTP_NO_SOCKET == serverSocket )
{
serverSocket = socket(AF_INET, SOCK_STREAM, 0);
}
if ( -1 == serverSocket)
{
syslog(LOG_ERROR, "Could not create server socket");
continue;
}
if(setsockopt(serverSocket, SOL_SOCKET, SO_REUSEADDR,(char *)&iAddrReuse, sizeof(iAddrReuse)) == (-1))
{
syslog(LOG_ERR, "Setsockopt failed for SO_REUSEADDR \n");
}
/* bind address to our socket */
if ( bindretVal == UPNP_HTTP_BIND_ERROR )
{
bindretVal = bind(serverSocket, (struct sockaddr *)&addrServer, lenSockAddr);
}
here while running i tried to print the ip address structure using inet_ntoa both before and after bind it shows me as the ip which i provided .
But when i run the netstat command it shows me a other ip as 255.255.255.255
regards