Solved

IdTCP client/server connection problem

Posted on 2004-04-18
13
812 Views
Last Modified: 2007-12-19
Hello.

I'm currently trying to make a program with Indy components. The idea is that people should be able to connect to a server via the internet with clients using TCP. The problem is that I can't get the whole connect thing to work over the internet.

How ever it works fine if the server and client is run on the same computer or the same intranet so it shouldn't be any problem with ports or something like that. Possibly it's a router problem but I would assume that it would get through something like that.

The error I get is "connection refused" and that would indicate that the client can't find the server even if it can find the IP. I have tried with IdSocksInfo but that only seemed to make things worse. Does anyone know what I'm doing wrong? Or alternatively: Does anyone have a simple example of a program that can communicate over the internet and through various proxies and other annoying things.

I can add more information about the setup if needed.
0
Comment
Question by:Rohan32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
13 Comments
 
LVL 1

Expert Comment

by:MarcoMi66
ID: 10853185
If you can connect in the Intranet but you cannot connect through the Internet, the more reasonable problem should be some firewall protection.
For testing purposes just use the telnet command from the client PC.
telnet <ipaddress> <port> and:
 - if you receive a blank page it usually means that the connection has been estabilshed
 - if you receive an error (such as "Impossible to connect to host...) it means that no connection is possible.

If you are in the 2nd case (and i think so) here are some questions:
 - Has the server a public IP Address?
 - Is the server public IP Address reacheble by Internet?
 - Has the Server some other service reacheble by Internet?
 - Is there some firewall that is blocking IP traffic on your ports?

You should have a public, fixed IP address (not 192.168.x.x, nor 172.16.x.x.-172.20.x.x, nor 10.x.x.x)
You can try to change the server port to a port "Normally left open by firewall" such as 80 (http).
If the problem still persist try netstat command on the server to look at the active connections.

Marco
0
 
LVL 7

Expert Comment

by:sftweng
ID: 10853308
MarcoMi66, you don't actually need a fixed IP address if you use a dynamic name service like http://www.tzo.com or http://www.dyndns.org. These typically have an application running on your machine which identifies itself to their DNS server so that the name can be resolved, even if you're behind a NAT/firewall router. So, for example, you can register a (free) domain name like "Rohan32Site.homeip.net" with DynDNS, and gain TCP access to it just by using the name Rohan32Site.homeip.net.
0
 

Author Comment

by:Rohan32
ID: 10853386
Well it does have betterluck with port 80, it doesn't receive the "connection refused" error but the client is disconnected at once. But I don't understand why the firewall would all of a sudden start blocking ports. I have a software firewall and a hardware one. I have never had to reconfigure the hardware one for games or anything like that, only the software one. Do multiplayer games generally run on ports reserved for that kind of activity or am I still missing something?

And to answer your questions:
 - Has the server a public IP Address? Yes
 - Is the server public IP Address reacheble by Internet? Yes
 - Has the Server some other service reacheble by Internet? Yes (on other ports)
 - Is there some firewall that is blocking IP traffic on your ports? See above
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:sftweng
ID: 10853505
If the firewall(s) have UPnP (Universal Plug and Play) support, they may allow quite a bit of flexibility for outbound connections and for the more common ports (e.g., FTP, SMTP).
0
 
LVL 7

Assisted Solution

by:sftweng
sftweng earned 50 total points
ID: 10853520
Have you considered running a test with the firewall support disabled? You could probably turn off the software firewall for a short test and, depending on the router you're using, step outside the router's firewall - for example, with the LinkSys BEFSR41 router, you can specify a single machine to sit in the "DMZ".
0
 
LVL 1

Expert Comment

by:MarcoMi66
ID: 10853724
On some firewall you have to "map" the public ip-port to the private ip of the machine on the inside network. It's sometimes called port-forwarding.
If you had a blank screen connecting on port 80, it means that an application running of that IP was listening to port 80. Was it an HTTP server or was it your socket app?

0
 
LVL 7

Expert Comment

by:sftweng
ID: 10854144
Rohan32, what is the make and model of the router/firewall?
0
 

Author Comment

by:Rohan32
ID: 10854481
Netgear RT311
0
 

Author Comment

by:Rohan32
ID: 10854626
Well some kind of manipulation with portforwarding seams to be the way I guess. Will play around a bit with the info on http://kbserver.netgear.com/kb_web_files/n101145.asp#RM356Anchor to try to get it to work properly. A thing is though that I want anyone to be able to host without a third computer acting as some kind of master server and without the user having to configure things like port forwarding, but that might not be possible.
0
 
LVL 1

Accepted Solution

by:
MarcoMi66 earned 75 total points
ID: 10857767
Yes Rohan you are right!
Even in P2P file sharing, if you are behind a firewall and no portmapping is provided (i.e. your IP/port cannot be reached FROM the Internet) you cannot exchange data with user in the same condition.
I think there is no way from solving it other than having a third machine that act like a governor.
0
 

Author Comment

by:Rohan32
ID: 13255712
I had almost forgotten about this. Well I guess I got an answer that it isn't possible which I will accept as answer. I have split the points based on effort.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 134
control image tags in a string ? 12 154
tvirtualstringtree freeze when load too manny images 10 81
shape, triangle, dbctrlgrid 3 33
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question