My Scenario is:
There are two pieces of software running on two different machines, one as a server and one as a client. They both use same ports for communicating to each other on UDP level. ( due to the client hardware it's not possible to set the communication on TCP level ( limited memory )). This scenario works already for like 15 years right now.
Now I want to make an emulator for this client, so that I won't have to use the client ( as it needs to be reconfigured everytime I need to debug and to do trouble shooting ). And it's not at the same location as where I'm at.
The thing I did was made a simple client application with a listenerport and a senderport ( same as the sever ) on a virtual network card ( created with de devcon utility )
Now when I run the client I get a SocketException:"Only one usage of each socket address (protocol/network address/port) is normally permitted" ( This is the first thing what happens when I start the client )
This happens at the line where I create the listener : UdpClient listener = new UdpClient(listenPort);
In the osi model there is first the network layer(ip addres) and then the port numbers ( with the TCP/UDP layer )..
7 Application Process Application
6 Presentation
5 Session
4 Transport Host to host TCP, UDP Packets
3 Network Internet IP, ICMP Frames
2 Data Link Network Access ARP Bits
1 Physical
The client is not listening on the same networkcard as the server is ( but they are both running on the same computer though ).
The thing I don't get is why this message? Might it be that's it's not possible to create a virtual network card and use the same ports on the same computer? ( As I want to run the client and server on the same computer )
[edit]
I was just wondering that it might not be possible just as for the reason that it's using one list of porst for all the network cards and therefore it's already being used. Then my question is:"how to make a second list of ports to listen too ( as it's different networkcard in the same computer?"
It's almost the same as VirtualBox or VirtualPC makes a new virtual network card. When they are created it's possible to listen on the same port ( although it's a virtualmachine ) but still is the same hardware. Then rises the question on how did they do it?
[/edit]