how can i use VPN in my socket application
I want to know how can i use VPN (Virtual Private Network)
in my application for connecting a remote LAN client.
i am explaning situation bt following figure:
---- ------ --- ---
|Machine A| --- >> |internet(WAN)| ---->> |Server|-- >|M/C B|
---- ------ --- ---
^--------^
(LAN)
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.
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.
# 1 Re: how can i use VPN in my socket application
The server will need for FORWARD a connection made from machine A to machine B. Since machine B doesn't have a public interface but the server does. So this means you can only connect to the server not machine B. The only way you can connect without using port forwarding is to connect from machine B to machine A.
Even though you know all the IP addresses your problem lies in the fact that NAT will work from the inside (LAN->WAN) out but not from the outside to in.
So the server will need to open a listen port, then forward all connections made on that port to machine B.
# 2 Re: how can i use VPN in my socket application
The server will need for FORWARD a connection made from machine A to machine B. Since machine B doesn't have a public interface but the server does. So this means you can only connect to the server not machine B. The only way you can connect without using port forwarding is to connect from machine B to machine A.
Even though you know all the IP addresses your problem lies in the fact that NAT will work from the inside (LAN->WAN) out but not from the outside to in.
So the server will need to open a listen port, then forward all connections made on that port to machine B.
Thanks friend,
but i can't use port forwarding because there may be many clients
want to connect LAN server.
can i make VPN connection in my application code?