Solved

IdTCP client/server connection problem

Posted on 2004-04-18
13
811 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
  • 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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