R
Roger
I am using a Socket object to communicate to a host over TCP/IP.
All works fine but I need to add functionality.
My computer has 2 network cards, each with its own IP address and I
want to communicate using only one of them.
I do the following:
MySocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp)
MySocket.Bind(LocalEP)
MySocket.Connect(EndPoint)
CommStream = New NetworkStream(HRDConnSocket, IO.FileAccess.ReadWrite)
.... then I read and write to/from the CommStream object.
LocalEP is an IPEndPoint object to the IP address, port 0 of one of
the network cards on my computer.
EndPoint is an IPEndPoint object to the host IP and port.
What happens is that the .Connect method connects through the proper
network card but all reads and writes occur on the other card.
I was expecting that the NetworkStream would obey what was set on the
socket but it does not seem to work like that.
If anyone can help, thanks
All works fine but I need to add functionality.
My computer has 2 network cards, each with its own IP address and I
want to communicate using only one of them.
I do the following:
MySocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp)
MySocket.Bind(LocalEP)
MySocket.Connect(EndPoint)
CommStream = New NetworkStream(HRDConnSocket, IO.FileAccess.ReadWrite)
.... then I read and write to/from the CommStream object.
LocalEP is an IPEndPoint object to the IP address, port 0 of one of
the network cards on my computer.
EndPoint is an IPEndPoint object to the host IP and port.
What happens is that the .Connect method connects through the proper
network card but all reads and writes occur on the other card.
I was expecting that the NetworkStream would obey what was set on the
socket but it does not seem to work like that.
If anyone can help, thanks