Re: TCP/IP file transfer and a router




<aca04pds@xxxxxxxxxx> wrote in message
news:1177256895.141267.214920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

I'm trying to create a Java program that can send a file from 1
Windows PC to another over a TCP/IP connection. As many people use
[wireless] routers, how can I create a TCP connection to PCs that are
connected to the internet via a router? The router has an IP and then
each PC connected to that has its own IP for their local network. How
would the router know which PC is the right one to send the data to?

If the LAN PCs are only running java.net.Socket (client sockets), you don't
need to do anything, since the NAT router keeps a table of requests, and
when the response comes back, the router automatically routes the response
to the proper requester using Network Address Translation (NAT).

For any PCs listening on java.net.ServerSocket, the router knows which PC to
send the data to using a router feature called "port forwarding". However,
you would have to assign a different port to each server behind the router,
because the router has a single address on the internet. Clients would have
to specify the host name and port in order to select a particular machine
behind the router.

Each PC on the LAN can listen on the same port, but you would need to
configure the router to publish each PC on a different port on the WAN.

By the way, this is not a Java problem, this is a router configuration
problem. Once you understand how NAT routers work, you can write the
solution in any language that supports TCP/IP (usually using Berkley
Sockets).


.



Relevant Pages

  • Re: Using Remote Desktop From an SBS Domain
    ... when you tried to RDP while attached directly to a port on your router? ... So if 3389 needs forwarded on the client end too then that is what the ... Hopefully next week I can attempt a connection while my ISP watches the ...
    (microsoft.public.windows.server.sbs)
  • Re: Using Remote Desktop From an SBS Domain
    ... when you tried to RDP while attached directly to a port on your router? ... Internet to initiate an IP conversation with your computer. ... This situation is different than if you ran your own NAT connection sharing ...
    (microsoft.public.windows.server.sbs)
  • Re: Setting up Home Network w/ 2 Routers
    ... successfully got my 2Wire, Netgear, and Linksys playing nicely. ... Connected the LAN port #1 of 2Wire to the WAN port of the Netgear. ... connection type and all for me. ... If you add another router to the mix, just make sure to disable the ...
    (microsoft.public.windowsxp.network_web)
  • How did they get behind my NAT?
    ... this point I panicked and shutdown the VNC service ASAP. ... My question is how the attacker got to my VNC port! ... the internet through the router. ... client connection using local port number 5900 (which was also being ...
    (alt.computer.security)
  • Re: Can not access Web and FTP sites from Internet
    ... your IP Configuration on the Server is correctly. ... Connecting To 12.208.215.87...Could not open connection to the host, ... 1> From the result, we can see the telnet failed, which means the router ... does not forward Port 443 to SBS Server. ...
    (microsoft.public.windows.server.sbs)