client socket

I have a client socket program written in c++ ,connecting to local ip:9102

1
2
3
if (connect(fd,(struct sockaddr *)&addr, (socklen_t)sizeof(struct sockaddr)) == -1)
   return -1;
 cout<<"Connected ,ERRNO:"<<errno<<", txt:"<<strerror(errno);


I don't have any application(server socket) listening on port 9102 on my local server.
But when i run this code,connect is returning 0

Connected ,ERRNO:42, txt:No message of desired type

and a netstat shows
1
2
netstat -na |grep 9102
tcp        0      0 192.168.151.42:9102         192.168.151.42:9102         ESTABLISHED


both the endpoints(local and remote) are same.

Any suggestion
Topic archived. No new replies allowed.