Solved

Problem with winsock client/server URGENT! 500pts

Posted on 2006-06-10
13
228 Views
Last Modified: 2010-04-05
Hi guys

K heres the problem i created a program that uses a server[as server] and clients to connect to it...

setup:

[PC1][PC2][ PC3][Server]
  |       |        |       |
   \      |        |      /
     \    |        |    /
       \  |        |  /
[ADSL Modem ROUTER]
               |
          Internet

K i use port 2000 as my port for the programs server/client, on my Computer everything works fine, its when i take it to clients that i cant seem to get the clients to connect to the server or visa versa (like the diagram above)

The Server client is run on the server
            *PROBLEM*
      PC1-3 connects to server

I have let port 2000 open TCP/UDP on all the machines server and client, but it still wont connect...
When windows firewall pops up and asks, unblock i click unblock...

Q: Is there something that im missing in order to connect these PC's together over IP

Im using D7 XPSP2, standard delphi sockets
0
Comment
Question by:Scay7
  • 7
  • 6
13 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 16876794
I'm sure you know all this stuff, but I'll post it just in case.
Check your ADSL configuration, you probably need to setup NAT (network address translation/pinholing)
eg, when i run a server behind my router, i would open up port 2000 on the modem, directing all incoming calls on port 2000 to my server's local ip address.

You may also need to allow port 2000 in your modem's firewall
You may also need to allow port 2000 in your computer's firewall

for "me" to talk to your server, I need your "internet ip" , not your local network ip, or your router's ip, but the ip address assigned to your modem when it connects to the internet
go to http://whatismyip.com/ to see what that might be
this is the address you need to tell your clients to try to connect to.

for testing, disable all firewalls, (pcs and modem) and see if you can connect. if you can, turn them on 1 by 1 to see where the block is.

Another problem you can get is if both you and the client are behind firewalls, but this should not be a problem for a simple "connect" as in your case.
I'll have a think and post more once I get some caffeine
0
 
LVL 5

Author Comment

by:Scay7
ID: 16876803
K same problem :

PC1 = Server;
PC2 = Client;

K now there is no modem acting as router, just a plain HUB connecting all the pcs together and the modem connected to that HUB giving all the pc's internet

Im not connecting to the SERVER through the internet... just PC1 trying to get to PC2 both firewalls OFF and its still wont connect...

Scay7
0
 
LVL 5

Author Comment

by:Scay7
ID: 16876806
Oh also forgot to mention

PORT on Client and SERVER = same
Client connects to SERVERs  TCP IP

eg : Client = 10.10.10.100
      Server= 10.10.10.1

Subnet masks = ALL 255.255.255.0
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16876895
so the client ping the server successfully?
0
 
LVL 5

Author Comment

by:Scay7
ID: 16876912
ye they can ping each other...
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16876920
try telnet from the client to the server
start- run- cmd.exe

telnet 10.10.10.1 2000
type test commands
(ctrl-c to quit)
does that work? if so, check your client code, and make sure it is not hardcoded to "localhost' ;-)
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 5

Author Comment

by:Scay7
ID: 16876964
ClientSocket1.Address := edit8.Text; //server ip
 ClientSocket1.Port := 2000; //port
 clientsocket1.Open; //open

Telnet works
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16877109
if the client can't connect remotely, you must be getting an error. what error do you get on the client? (10054, 10061, etc)
do you have a short 'connect timeout' set?
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16877118
some other possibilities.
no tcp installed on the client pc :-)
anti-virus (some are quite promiscuous)
0
 
LVL 5

Author Comment

by:Scay7
ID: 16877809
- K i got the error code from them : 10061
- No timeout just doof cant connect
- TCP installed and working
- Plain antivirus without firewall, using windows firewall...
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16879377
if telnet is working from the client, and you do not have a firewall/av active that is specifically blocking your application, then it must be the code in the project
i think I have it :-)

Set ClientSocket1.Host
not ClientSocket1.Address
0
 
LVL 5

Author Comment

by:Scay7
ID: 16973309
"eg, when i run a server behind my router, i would open up port 2000 on the modem, directing all incoming calls on port 2000 to my server's local ip address."

I think this is the problem... how do i set a billion ADSL modem to

send data from pc's to server
and
send data from server to pc's

I have a basic idea, about NAT...

Sorry for the time gap, had other pressing matters aswell :P

Peace Scay7
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17068778
I really mean it :-) have you tried setting the "host" property instead of the "address" property

aside from that.
you only need to set up the adsl NAT on the server's ADSL modem, not the clients
adsl modem's and routers allow most "outgoing" connections unless they have set up a specific rule denying it
it is only the server that needs the pinhole, so I don't think this is yuor problem.
Let me know if the "host" porperty fixes it or not


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

9 Experts available now in Live!

Get 1:1 Help Now