TCP File Transfer behind NAT

Discussion in 'C Programming' started by Saurabh, Apr 3, 2008.

  1. Saurabh

    Saurabh Guest

    Dear All,

    Can anyone tell me, how to write such a program that can transfer
    files (either binary or text) behind NAT devices( such as for
    computers behind firewalls and routers and other NAT devices) using
    TCP socket programming.

    I have a mechanism through which the public IP of the router and Port
    number will be forwarded to me. But after that I am not sure that
    simple TCP/IP socket programming will suffice or I need to do
    something more for that.

    If you have any article link or article or any example that shows how
    the File Transfer can be done for such a case then please help me
    regarding this.

    Any sought of help or idea will be appreciated from you all.

    from-
    Saurabh Srivastava
     
    Saurabh, Apr 3, 2008
    #1
    1. Advertising

  2. In article <>,
    Saurabh <> wrote:

    >Can anyone tell me, how to write such a program that can transfer
    >files (either binary or text) behind NAT devices( such as for
    >computers behind firewalls and routers and other NAT devices) using
    >TCP socket programming.


    The C standards do not know anything about networking, let alone
    NAT. Networking matters are platform dependant. You should ask
    in a development newsgroup that supports your operating system.
    --
    "History is a pile of debris" -- Laurie Anderson
     
    Walter Roberson, Apr 3, 2008
    #2
    1. Advertising

  3. On 3 Apr 2008 at 10:11, Saurabh wrote:
    > Dear All,
    >
    > Can anyone tell me, how to write such a program that can transfer
    > files (either binary or text) behind NAT devices( such as for
    > computers behind firewalls and routers and other NAT devices) using
    > TCP socket programming.
    >
    > I have a mechanism through which the public IP of the router and Port
    > number will be forwarded to me. But after that I am not sure that
    > simple TCP/IP socket programming will suffice or I need to do
    > something more for that.


    No, you don't need to do anything unusual: from the outside, NAT is
    completely transparent, so you can just deal with whatever port number
    on the external-facing router and it will take care of forwarding it
    within its internal network as required.

    The only problems that might arise are if you're using some complicated
    secure tunneling arrangement that confuses the NAT front end.
     
    Antoninus Twink, Apr 3, 2008
    #3
  4. In article <>,
    Antoninus Twink <> wrote:

    >No, you don't need to do anything unusual: from the outside, NAT is
    >completely transparent, so you can just deal with whatever port number
    >on the external-facing router and it will take care of forwarding it
    >within its internal network as required.
    >
    >The only problems that might arise are if you're using some complicated
    >secure tunneling arrangement that confuses the NAT front end.


    Or if you're using a protocol such as FTP, which sends addresses
    (port numbers) as part of the data itself. Then the NAT device
    doesn't know to set up a mapping, and even if it did the port
    number carried in the message would be wrong.

    NAT implementations usually know about a handful of protocols of
    this kind, and inspect and munge the data accordingly. Alternatively
    the program may use some other protocol such as upnp to inform
    the router.

    -- Richard
    --
    :wq
     
    Richard Tobin, Apr 3, 2008
    #4
  5. On 3 Apr 2008 at 21:44, Richard Tobin wrote:
    > In article <>,
    > Antoninus Twink <> wrote:
    >
    >>No, you don't need to do anything unusual: from the outside, NAT is
    >>completely transparent, so you can just deal with whatever port number
    >>on the external-facing router and it will take care of forwarding it
    >>within its internal network as required.
    >>
    >>The only problems that might arise are if you're using some complicated
    >>secure tunneling arrangement that confuses the NAT front end.

    >
    > Or if you're using a protocol such as FTP, which sends addresses
    > (port numbers) as part of the data itself. Then the NAT device
    > doesn't know to set up a mapping, and even if it did the port
    > number carried in the message would be wrong.
    >
    > NAT implementations usually know about a handful of protocols of
    > this kind, and inspect and munge the data accordingly. Alternatively
    > the program may use some other protocol such as upnp to inform
    > the router.


    You're right, of course, but I think modern NAT devices handle many
    common protocols transparently to outside users - this will almost
    certainly be the case for FTP or whatever protocol the OP intends to use
    to transfer his files.
     
    Antoninus Twink, Apr 3, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saurabh

    TCP File Transfer behind NAT

    Saurabh, Apr 3, 2008, in forum: Java
    Replies:
    2
    Views:
    508
    Roedy Green
    Apr 3, 2008
  2. Saurabh

    TCP File Transfer behind NAT

    Saurabh, Apr 3, 2008, in forum: Java
    Replies:
    0
    Views:
    318
    Saurabh
    Apr 3, 2008
  3. Saurabh

    TCP File Transfer behind NAT

    Saurabh, Apr 3, 2008, in forum: Java
    Replies:
    0
    Views:
    257
    Saurabh
    Apr 3, 2008
  4. Saurabh

    TCP File Transfer behind NAT

    Saurabh, Apr 3, 2008, in forum: Java
    Replies:
    1
    Views:
    453
    Marcelo Morales
    Apr 3, 2008
  5. Saurabh

    TCP File Transfer behind NAT

    Saurabh, Apr 3, 2008, in forum: C++
    Replies:
    1
    Views:
    264
    Michael DOUBEZ
    Apr 3, 2008
Loading...

Share This Page