| Author |
urgently help me in (connection timeout exception)
|
Maged Roshdy
Greenhorn
Joined: Feb 08, 2003
Posts: 24
|
|
hi ranchers could anyone help my to understand the problem in my chatting program 1. in my program there is a server running (main server) for public chatting and many clients loggs on that server. 2. evrey client have a list of his freinds when he click on any of them he starts a private chat with his freind. 3. when the client click on his frind's name he retreveis his ip from the server and he try to connect to his freind (now his freind will act as server and he will act as client)and start a private chat. this program is working properly on the LAN but when i work on the internet the private chat unforunaitly ain't work and the client(Socket) couldn't connect to his freind (ServerSocket), the client throws the following exception java.net.ConnectException:Connect refused:connection timeout. i think the porblem is near this fragment of code ----------------------------------------------------------------------- Socket client=new Socket(); InetAddress inet=InetAddress.getByName(urls);//urls is the ip of other peer client.connect(new InetSocketAddress(inet,2050),0); ----------------------------------------------------------------------- and i use the same fragment when i connect to the main server(public chat server). ----------------------------------------------------------------------- Socket client=new Socket(); InetAddress inet=InetAddress.getByName("www.mycompany.com"); client.connect(new InetSocketAddress(inet,2050),0); ----------------------------------------------------------------------- and it works properly. plz if there any solving to my problem if not tell my why my program doesn't work on the internet. thanks in advance..
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
If a client is behind a NAT box or a firewall, it most likely won't have a public IP address, and so this code simply can't work by definition. For true peer-to-peer networking to work, the machines involved must be "peers" -- they have to have, at some level, addresses on a common network. For home users with a NAT box (i.e., LinkSys Cable/DSL Router) most of these devices have a "DMZ" setting or other configuration that lets incoming packets be forwarded to a particular host machine, either for all ports or for just a specific port.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Maged Roshdy
Greenhorn
Joined: Feb 08, 2003
Posts: 24
|
|
thank you Friedman for your reply could you please tell me how to do this setting i'm working on windows xp and do all the users of that application have to do this setting.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
|
As I said, it's a setting that many home hardware routers have. Everyone's setup will be different. Some people will use a "personal firewall" that consists of Windows software; other people will have personal hardware NAT boxes. Still others are on a corporate network or other arrangement where the address mapping is totally beyond their control. I really can't give you any specific advice.
|
 |
 |
|
|
subject: urgently help me in (connection timeout exception)
|
|
|