Solved

IdTCP client/server connection problem

Posted on 2004-04-18
13
807 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 7

Expert Comment

by:sftweng
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Expert Comment

by:MarcoMi66
Comment Utility
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
Comment Utility
Rohan32, what is the make and model of the router/firewall?
0
 

Author Comment

by:Rohan32
Comment Utility
Netgear RT311
0
 

Author Comment

by:Rohan32
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now