Tarik
Tarik

Reputation: 2261

2 TcpClient on same machine and port

I'm a beginner with the C# and network programming and I have a question: - I have a TcpListner and 2 TcpClient on port 100 they all run on the same machine so does the second client work? or does it give an error - port already in use?

Upvotes: 2

Views: 1193

Answers (1)

Paul Cichonski
Paul Cichonski

Reputation: 388

They should both work since the client doesn't occupy any port, it just connects to it. You can have multiple clients connecting to the same port (i.e., an analogy would be multiple web browsers connecting to the same web server). You can't have two servers on the same port though, but that doesn't sound like what you are trying to do.

One easy way to find out would be to just run everything and see if you are getting errors.

Upvotes: 2

Related Questions