J
Jonathan Woods
Please find file for illustrating infrastructure -->
http://test.thipparath.com/GPRS/GPRS.jpg Gateway receives packets from
Trucks for processing Route/GPS position. When Truck and Gateway
communicate in leased line, Gateway identifies different IP sent by
different truck. Where communicate over internet, NAT Server is used
for sending packets from different Trucks. Here is come to a problem
that Gateway unable to create individual Truck Session for tracking for
each truck GPS position because every packet received from internet is
Same IP address.
Hence, I would like to simulate NAT reverse translation function
(separate source IP in Packets to different IP according to data in
Packet). I decided to develop C# sockets offered in .NET framework. My
application will play 2 roles – 1) Act Server to listen inbound
packet from internet, 2) Act Client to forward captured packet to
Gateway with different IP as the following flows:
1) Create Asynchronous Socket for Listening
2) Reading data by Accepted Socket instance, analyze data ( data
contain SIM No for key ), Lookup Table in Database or Generate virtual
IP
3) Forward data with Different virtual IP
Problem Section (Sending data to Gateway)
// I want to generate virtual IP
IPAddress ipHostAddress = IPAddress.Parse(“192.XX.XX.XXXâ€);
IPEndPoint localEndPoint = new IPEndPoint(ipHostAddress,0);
Socket sender = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
sender.Bind(localEndPoint); //  I can’t bind virtual IP
// ( Requsted address invalid in it context ) Socket Exception thrown
sender.Connect(remoteEndPoint);
I sincerely would like to know yours idea in the scenario like this. Is
there any other ways? Thanks in advance.
http://test.thipparath.com/GPRS/GPRS.jpg Gateway receives packets from
Trucks for processing Route/GPS position. When Truck and Gateway
communicate in leased line, Gateway identifies different IP sent by
different truck. Where communicate over internet, NAT Server is used
for sending packets from different Trucks. Here is come to a problem
that Gateway unable to create individual Truck Session for tracking for
each truck GPS position because every packet received from internet is
Same IP address.
Hence, I would like to simulate NAT reverse translation function
(separate source IP in Packets to different IP according to data in
Packet). I decided to develop C# sockets offered in .NET framework. My
application will play 2 roles – 1) Act Server to listen inbound
packet from internet, 2) Act Client to forward captured packet to
Gateway with different IP as the following flows:
1) Create Asynchronous Socket for Listening
2) Reading data by Accepted Socket instance, analyze data ( data
contain SIM No for key ), Lookup Table in Database or Generate virtual
IP
3) Forward data with Different virtual IP
Problem Section (Sending data to Gateway)
// I want to generate virtual IP
IPAddress ipHostAddress = IPAddress.Parse(“192.XX.XX.XXXâ€);
IPEndPoint localEndPoint = new IPEndPoint(ipHostAddress,0);
Socket sender = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
sender.Bind(localEndPoint); //  I can’t bind virtual IP
// ( Requsted address invalid in it context ) Socket Exception thrown
sender.Connect(remoteEndPoint);
I sincerely would like to know yours idea in the scenario like this. Is
there any other ways? Thanks in advance.