473,544 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket Bind (Virtual Local EndPoint)

Hi there,

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
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.X XX”);
IPEndPoint localEndPoint = new IPEndPoint(ipHo stAddress,0);

Socket sender = new Socket(AddressF amily.InterNetw ork,
SocketType.Stre am,
ProtocolType.Tc p);

sender.Bind(loc alEndPoint); //  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.

Feb 15 '06 #1
1 3996
Hello, Jonathan!

You have to bind to an existing IP address.
IMO you can do following:
- generate IP packets using raw sockets ( hard way )
- install virtual pc ( e.g. like VMWare ) and assign different IPs to these virtual PCs ( much easier way )

Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Rolln_Thndr | last post by:
I'm vey new to network programing and have a few rather fundemental questions. I'm creating a very basic UDP proxy server and having a few issues regarding the sockets. Is it possible to change the properties of a socket WITHOUT closing it and creating a new one? Basically, I need to change the port of a bound socket, but the only way I...
by: Joe | last post by:
Hi, I browsed the news and a few seem to have this problem too, but no solution ! I have a client server application where in case the connection gets bad (crashes or whatever) client or server (who knows it first) closes the socket and than wants to establish the SAME connection again ( due to firewall reasons it has to be the SAME IP...
by: Rene Srensen | last post by:
We are 4 students working on a assignment, that our teacher gave use, normally we do this is C++, but the 4 of us, use C# more often that C++ so We made a small games called reversi, now our job is to make a server, none of us know nothing about socket programming in C#, but we founds some guides for this, and now ,got a server running, but...
by: Colin | last post by:
I'm writing a little console socket server but I'm having some difficulty. Can I ask your advice - where is the best place to get some help on that topic? It would be nice if some people who knew what they were doing could take a look at my code and tell me where and why I'm going wrong. Any suggestions of groups or forums?
by: Macca | last post by:
Hi, I have a synchronous socket server which my app uses to read data from clients. To test this I have a simulated client that sends 100 byte packets. I have set up the socket server so that its buffer is bigger than this. I did this expecting the data to be read in one pass.
by: Macca | last post by:
My app has an asynchronous socket server. It will have 20 clients connected to the server. Each client sends data every 500 millisecondsThe Connections once established will not be closed unless there is a problem with the connection. I need to know which client has sent the incoming data as each client has its own buffer on my "server"...
by: Macca | last post by:
Hi, I am writing an asychronous socket server to handle 20+ simulataneous connections. I have used the example in MSDN as a base. The code is shown at end of question. Each connection has a number of different types of data coming in. I have a databuffer for each type of data coming in.
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I tried a test, and I can't bind two sockets to the same port/ip but I can connect with one socket, and bind with another to the same ip/port. Thanks
by: keksy | last post by:
Hi every1, I am writing a small client/server application and in it I want to send an image asynchronous from the client to the server through a TCP socket. I found an example code on the MSDN site, which is actually for sending strings. I tried to adapt this code so that the client sends an image instead of a string. However, there is...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.