Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm working on a program where I need to get two machines talking to eachother over the network. I managed to get them to talk to eachother on a normal network by using TcpClients their NetworkStreams while passing messages in a set format.

Yet, these machines aren't going to be connected to eachother over a normal network, but a network bridge. The client machine is going to have two network cards. One to connect to a normal network, and a second card to connect directly to the server machine.

Now that I've got the client and server machines set up this way (I haven't done any actual configuration changes to the server machine), I can't seem to get the TcpClient object on the client machine to connect? Does anyone have any suggestions that might help me with this?

* When I run ipconfig on the server machine, I still get the original IPv4 address that I got before, which is what I'm passing to the TcpClient on the client machine.
* I've also tried using the IPv6 of network connection 2 (the one dirrectly connected to the server) and I get an error saying that the protocal doesn't support this type of address.
Posted
Comments
Dave Kreskowiak 24-Jan-12 20:49pm    
It sounds like you've got a machine with 2 network cards acting as a bridge between to the network. one network has a client machine on it and the other has the server machine. Correct?

These two networks need to have a router between them running on the machine with two network cards. These two networks cannot be the same subnet. They must be different subnets. Google for "Routing and remote access" for the docs on a feature of Windows to do this.

Currently, there is no route between the networks so your client cannot talk to the server.
Francisco T. Chavez 25-Jan-12 14:32pm    
Just before leaving work last night, I noticed that the server machine had a red light where we plug in the network cable. So, I tried plugging it back into the regular network to see what would happen, and the light turned green. At that point we figured that the two probably didn't want to talk directly to each-other and that we would need to try using a hub next.
Francisco T. Chavez 25-Jan-12 18:55pm    
I've connected the client machine to the server machine using a network router. I can now successfully ping the each machine from the other machine. Yet, when I tell the client machine's TcpClient object to connect, I get a timeout error.
Dave Kreskowiak 25-Jan-12 22:21pm    
Did you ping the other machine by name or by IP address? Does your code also try to connect to the server machine by IP address? Does the server have a firewall? Is there a hole punched for the ports your application is using?
Francisco T. Chavez 26-Jan-12 13:44pm    
I did the pinging by IP, which is also how I set the address for the TcpClient. Right now, I'm communicating with IT, in order to add an exception to the computer's firewall for the program.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900