I am making a chatting application using winsock2 (server-client). I have made communication using loopback IP and also on same LAN it is working fine. However, while I go in internet the connect() function in client side gives error 10060 which is connection time out.
I am not able to figure out why it is happening. Is there any test I can perform
I dont think there is any firewall blocking. I was trying with 192.168.x.x series of IP(for both client and server). I was unsuccessful in connecting between my client and my server. However, I tried with 115.x.x.x series of IP (for server), my client was able to connect it which was on 192.168.x.x.
I dont understand what is the issue. If anyone have any solution please discuss.
It's impossible to determine your network topology from what you've specified. The only helpful straightforward advice I can add is, if you can't ping one machine from the other, your app won't be able to see the other side.
You clearly have routing issues but haven't described the network topology.
@ OP: You seem to be giving contradicting information, in your first post you say "...also on same LAN it is working fine. However, while I go in internet the connect() function in client side gives error 10060 which is connection time out." but later you post the opposite "I was trying with 192.168.x.x series of IP(for both client and server). I was unsuccessful in connecting between my client and my server."
'192.168.xxx.xxx' implies a local intranet connection which first you say succeeded then you say failed, the '115.xxx.xxx.xxx' connection tells me that you went outside your network to the internet then back in to connect to the box which you say first failed then later that the client was able to connect. Which one failed? Do they both fail intermitently?
I'm partly dismissing this as a grammer breakdown but you almost seem to be saying that your client is excepting outside connections but rejecting connections from the local network, if this is the case you have bigger things to worry about right now then getting Winsock2 to work.
I guess you have mis-interpreted the issue. I will try to give a clear picture.
Client is accepting connection with server in following situations:
1. When I use loop back IP for server and client. (server at 127.0.0.1, client at 127.0.0.1)
2. When I use local LAN (intranet). (server at 198.168.xxx.xxx, client at 198.168.xxx.xxx)
3. When I take the server to 115.xxx.xxx.xxx and client at 198.168.xxx.xxx
Client is not accepting connection with server in following situations:
1. When i take server to 198.168.xxx.xxx and client at 198.168.xxx.xxx, but over internet, outside my LAN.
You still haven't said whether this client host can ping the server host.
Describing an address as 192.168.xxx.xxx illustrates some point, but is so technically imprecise as to be almost useless, especially when you say something like server at 198.168.xxx.xxx, client at 198.168.xxx.xxx.
The 192.168 .xxx.xxx range is reserved for local intranet connections only. They are not "real" addresses so to speak so you won't be able to reach anything across the internet on them. Check this out for a very brief overview on what is actually a career field of its own: http://en.wikipedia.org/wiki/Private_network
EDIT: I just realised that you've been entering both '198.168...' and '192.168...' which one do you mean?