I am trying to create socket to communicate over TCP/IP.
All works just fine but I need to add some functionnality.
I have 2 network cards on my computer each having one IP
address.
I want the communication to happen on a specific one.
So I do the following:
MySocket = New Socket(AddressF amily.Unspecifi ed,
SocketType.Stre am, ProtocolType.Tc p)
MySocket.Bind(L ocalEP)
MySocket.Connec t(EndPoint)
MyNetworkStream = New NetworkStream(H RDConnSocket,
IO.FileAccess.R eadWrite)
..... later I write and read to MyNetworkStream
So,
-LocalEP is an IPEndPoint and I used DNS.Resolve using one
of the network cards IP address with a port of 0.
-EndPoint is also an IPEndPoint I also resolved using my
host IP and port.
What happens is that I connect properly and it connects
through the proper local network card. But all
communication happens on the other card. It looks like my
socket obeyed my local end point but the stream I created
does not respect it.
So, how can I get my reads and writes to the NetworkStream
to happen on the specific network card.
Thanks.
All works just fine but I need to add some functionnality.
I have 2 network cards on my computer each having one IP
address.
I want the communication to happen on a specific one.
So I do the following:
MySocket = New Socket(AddressF amily.Unspecifi ed,
SocketType.Stre am, ProtocolType.Tc p)
MySocket.Bind(L ocalEP)
MySocket.Connec t(EndPoint)
MyNetworkStream = New NetworkStream(H RDConnSocket,
IO.FileAccess.R eadWrite)
..... later I write and read to MyNetworkStream
So,
-LocalEP is an IPEndPoint and I used DNS.Resolve using one
of the network cards IP address with a port of 0.
-EndPoint is also an IPEndPoint I also resolved using my
host IP and port.
What happens is that I connect properly and it connects
through the proper local network card. But all
communication happens on the other card. It looks like my
socket obeyed my local end point but the stream I created
does not respect it.
So, how can I get my reads and writes to the NetworkStream
to happen on the specific network card.
Thanks.