General discussion


How to connect a NAT behind machine

By harishdixit ·
please tell me how a machine connected to internet will send Connect request to it's LAN client behind a NAT. Because first request will go to the LAN server. And this LAN client is not directly visible to us.

it returns "Socket is not connected" error code - WSAENOTCONN

situation is like:

------------- ------------------ --------- --------
|Machine A| --------- >> |internet(WAN)| ------------>> |Server|----- >|M/C B|
------------- ------------------- --------- --------


machine A is not in a LAN, it is connected to internet with static IP. while B is in a LAN, behind a Server . and this server having public IP Address. B is not directly accessible , we can access it only through server. my one application is running on B and can connect to A when a connection request is made. My another apllication is running on A.

A has a static IP, while machine B is not publicly visible outside world. but we know IP address of server,and of machine A and machine B. and also port no on B and A.

problem is that when i send a connect request to B from A, via Server
then connection is not established.

If we try to establish a connection from B to A then it succeded,
while from A to B it will not.

port forwarding is one solution.But my situation is that
there may be many machines on the LAN and many outside machines
can connect to these LAN machines. Means (m to n) relationship is there.
So in this case how port forwarding will work ?

each time in my connect() request my destination
machine address will be changed.

Is there any solution by which we can do port forwarding for
any destination machine.Means it should be independent
on any manual entry in NAT device.

I am using socket programming Winsock 2 API in VC++.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by HAL 9000 Moderator In reply to How to connect a NAT behi ...

If I understand your question correctly you want to connect across different Domains or work groups to allow one computer to access another right?

As you have said that Port Forwarding will be to difficult as there are so many units connected and you want to do this is a secure manner have you thought about establishing a VPN between the Machine A and server so you can access machine B?

If you did it that way you would remove the need for any Port Forwarding and would have a permanent secure connection available.

Or is this a Class assignment all about Port Forwarding?


Collapse -

by jdclyde In reply to How to connect a NAT behi ...

vpn is the solution.

Once the tunnel is setup between sys A and the server, they will have the equivilate of a LAN connection and have the same access as sys B has to that lan.

Mind you, if sys B is a desktop, you will have to set it up for remote access.

Collapse -

by CG IT In reply to How to connect a NAT behi ...

in addition to answer # 2 you have to setup the server to allow remote access. RRAS is the routing and remote access program that sets up PPTP and L2TP remote access connections.

Related Discussions

Related Forums