Human wrote:
> Wow.
> I really thank you all. Now I have a point from where to start.
> I imagined that I should let the user to provide the REAL IP of the computer 
> and not the internal
> IP.
> However, I did not know how to handle the firewall/NAT. But I think you are 
> right: it is all down
> to user's knowledge about how to configure its own firewall/NAT box.
>
> I think that I should try to detect the real IP then to let the user to 
> choose a port that will be
> used by the client. The user should 'open' this port in his firewall.
> So now the client will send to the server the real IP, the time stamp AND the 
> port.
>   
Detecting the IP should be done at the SERVER, not at the client. By the 
time the connection makes it to the server it has it's source ip 
properly set up to the routable IP responsible for the client's 
computer. If the client's computer has a real IP address, that's the 
address the server will see. If the client is behind a NAT box the 
server will see the IP address associated with the NAT box. This will 
save you lots of trouble in the long run (dynamic IP address kind of 
trouble etc).

Finally, you might consider simplifying the "registration" procedure for 
a client. Have the client only send it's port number. The IP address 
would be easily filled by the server. The time stamp would be better 
handled by the server so all time-stamps are based on the same clock and 
are not affected by different time-zones etc. You might also want to 
include some kind of unique id for the connection so you can invalidate 
a client's former IP address when the client gets assigned a new IP 
address from it's ISP.
> The server application is hosted in the same place as the web site at an 
> American web hosting
> company on a professional account.
> They do not have dynamic IP and I never had problems with their firewall so I 
> do not need to worry
> about this.
>   
You say you never had any problems with your hosting firewall - but have 
you ever tried it? Unless you tried running some strange services on the 
server, listening on strange ports, you might not know if your hosting 
firewall allows stuff to go through or not. Besides, this is probably 
not an issue for you if you're planning on using a simple PHP page for 
your "registrar". That's because PHP doesn't listen on ports by itself, 
it runs within Apache or IIS.

Ex: If a client wants to register itself it reads this page: 
http://www.yourserver.yourisp.com/register.php?port=123
Ex: A client wants the list of registered peers. It reads this page: 
http://www.yourserver.yourisp.com/regsitered.php?last_query_time=123

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to