Article View: borland.public.cppbuilder.internet.socket
Article #2283Re: Is the server reachable?
From: Remy Lebeau (TeamB)
Date: Tue, 06 Jun 2006 02:41
Date: Tue, 06 Jun 2006 02:41
31 lines
2597 bytes
2597 bytes
"sez" <www@sezginserin.com> wrote in message news:4484e97d@newsgroups.borland.com... > if I wouldn't add the port, my friend would get connection error. > In order to prevent this, when I activate the server, the program > must check if the server is reachable. It won't be able to. Only the client will be able to detect that when it tries to connect to the server. All the server can do is report whether it was able to bind to the local IP/port that the router is configured to forward traffic to. The server won't even know that a router is even present on the network, since the router acts as the client. So as far as the server ever knows, if it binds successfully, then it is always reachable on the network. The server will have no clue how clients reach it from outside the network. To get around this, you need to swap the roles of the sockets. In other words, if Player A opens a server socket that Player B tries to connect to, and the connection fails for any reason, then Player B can open its own server socket that Player A then tries to connect to. Chances are, the connection will succeed in one direction or the other. That is how most modern p2p applications work nowadays. Typically, the only time it wouldn't work at all is if both parties are behind their own individual routers and neither one is properly configured for port forwarding. The only way to make the connection work in that scenerio is to have both parties connect to an external server that acts as a proxy who forwards data back and forward between both connections. Gambit
Technical Details
Message-ID:
<4484ed5c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4484e97d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,213cc464ab5ebf2 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4484e97d@newsgroups.borland.com> Subject: Re: Is the server reachable? Date: Mon, 5 Jun 2006 19:41:22 -0700 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <4484ed5c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1149562204 68.69.17.41 (5 Jun 2006 19:50:04 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail