Ahmad Nassar
Ahmad Nassar

Reputation: 39

C# Socket Connections using VLANs

Using C#, I am trying to establish a tcp connection, then send tcp packets to a remote device

Socket sock = new Socket(System.Net.Sockets.AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress destAddress = IPAddress.Parse("10.30.5.222");
sock.Bind(new IPEndPoint(IPAddress.Any, 14500));
sock.Connect(destAddress, 14500);

What happens is that my program sends an ARP request, but the remote device discards it.

Root cause that the remote device is accepting only vLan Tagged frames with a specific vLan Id. However, my C# code sends ethernet frames with out vlan tagging.

Is there any way to send vLan tagged frames? I read about pcapdotnet. But as far as I understand it only send single packets. and this means that I will need to do the following manually in the code to establish connection:

same hassle in each sending, fragmentation, ...etc

Is there a way to configure my communication to be vLan tagged, without writing packet by packet? (preferred in C#)

Upvotes: 3

Views: 1101

Answers (0)

Related Questions