MK27, now i end up in a different problem
i have used the same code which i have attached in the previous post and declare two macro
and instead of INADDR_ANY i have replced it with corresponding call to include the IP which i have defined as macro
#define SERVER_ADDR "10.0.3.92"
#define CLIENT_ADDR "10.0.3.92"
Now if i try to execute the code, listen call gets success and when tried to connect my program hangs there and when i try to see the netstat -na results i am getting the following things
/* Bind to socket */
serveraddr.sin_family = AF_INET;
serveraddr.sin_addr.s_addr = inet_addr(SERVER_ADDR);
serveraddr.sin_port = htons(PORT);
clientaddr.sin_family = AF_INET;
clientaddr.sin_addr.s_addr = inet_addr(CLIENT_ADDR);
clientaddr.sin_port = htons(PORT);
But if i change both SERVER_ADDR and CLIENT_ADDR macro to "127.0.0.1" then the same code works fine. You have any idea about this?
root@10:~# netstat -na
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 10.0.3.92:9090 0.0.0.0:* LISTEN
tcp 0 1 10.0.3.92:2240 10.0.3.92:9090 SYN_SENT