Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

SOCKET PROGRAMMING VIA INTERNET

Socket programming is a method used for communication between Probe, Server


and Subject vehicles in soft safety. Socket programming works on the concept of client
server mechanism. The connection establishment is always initiated by the client which
sends a connection request to the server.
Previously socket programming was established on Local area network made of
Ethernet where both client and server will have private IP address. Conventional Socket
programming discussed above will work fine on LAN, but if we need to host server on
WAN(internet) certain problems need to be addressed that will be discussed below.
1. DYNAMIC IP:
The IP provided by ISP are dynamic in nature. They change every time when a
connection is made. If the server IP is not static, clients will have problem in connecting with
them. One possible solution for this is using Dynamic DNS. DDNS services like NO-IP and
Dynu offers free DDNS service.
Dynamic DNS works in the following way,
User register for a DDNS service and will be provided with a URL.
User installs DDNS software on their local machine. This application will associate the
IP address of the server with the URL even when the IP changes.
The client can connect with server using URL instead of IP.
2. HOSTING SERVER BEHIND NAT:
NAT (Network Address Translation) devices are commonly used to alleviate IPv4
address exhaustion by allowing the use of private IP addresses on home and corporate
networks behind routers with a single public IP address facing the public Internet. All routers
will have a preinstalled NAT with them. The public IP provided by the Internet service
provider will be allocated to the router and router will allocate private IP address for all
connected hosts.








Public ip: 100.1.21.203
Private IP: 192.168.0.1 192.168.0.2 192.168.0.3
NAT are designed to block any connection request from public network to reach
private network. NAT act as a firewall between public and private network. The clients on
the private network can access the external server, connect with them, communicate with
them but they themselves cannot act as a server.
In our soft safety case,
Probe vehicle and Subject vehicle can successfully acts as client behind NAT.
Hosting the soft safety server behind NAT is the only concern.
There are few techniques available by which one can successfully host a sever
behind NAT. Some of them are mentioned below.
2.1. Port forwarding The router can be configured to forward requests coming to a
particular port to a specified IP. Almost all the routers nowadays allows port forwarding,
user need to log in to router settings as admin and make the setting manually.
Steps for port forwarding:
Open router configuration panel and log in as admin
On the port forwarding section, add port which the server is hosting, select TCP as
the protocol and give the IP of the server in the IP field.
Pros - It is the simplest and most effective of all available NAT traversal techniques.
Cons User need to manually configure the router.

2.2. UPNP Universal Plug and Play is an attempt to extend the concept of ordinary plug-n-
play, so that it applies to more than just your own machine: it applies to the whole network.
UPNP provides a way to change the port mapping setting of the router via API running on
the host. NAT API is provided by MSDN (Microsoft Developer Network) which works on
most of the routers which have UPnP functionality.
Pros Port forwarding can be done remotely from the machine.
Cons Exploring the API and creating an application need more effort since documentation
on NATAPI are very scarce.
Other techniques such as SOCKS, Hole punching are bit more complex and have low
success rate compared to the above two techniques.

CONCLUSION
Concern is only with the server, probe and subject vehicle works fine on any router
or dongles. Following suggestions can be used, for executing socket programming over
internet.
NO-IP DDNS can be used to alleviate dynamic IP hindrance.
3G dongles which doesnt include NAT in its operation can be used for Server.
Port forwarding can be done either manually or using UPnP on the server router.

You might also like