I'm trying to make a client/server application with the Socket class from .NET but am having some problems.

Once the server is run, 3 clients should be able to connect to it, no more.
The clients aren't supposed to choose a port, they just enter the ip and press connect, the server should make sure that all 3 clients are accepted, and data can be revieved and sent back to them.
Further attempts of clients to connect to the server should be refused, untill another spot opens up. I don't mind whether it's done with a control array or not.

Mainly the problem I have is figuring out how ports are used. A client needs to setup an IPendpoint to connect, so it has to give a port. That port is the port on the serverside it connects with, no? (in that case, which port on the clientside is used).
The port the client uses for the connection, and the port the server uses, don't have to be the same, right?

I'm not asking you guys to write any code, just maybe explain the theory to develop what I'm trying to do.

Thanks in advance,