Hi everyone,
I want to write a chat program using sockets. But the thing i dont undestand is how to connect more than one client to a server. I mean when using a socket we have to provide a specific port. so lets say it is port 2000. so this is fine for a single client. because he can communicate with the server using that port 2000.
But the problem arises when the second cllient logs in. Because the client one is using the port 2000 the client two can not use it. (I don't have a clear idea about it but i think it is true, right? ,If any body can clear my undestanding about this i would really appreciate it.)
So for the second client i have to provide a diferent port. How can i do this? Do I have to store an array of ports for this? If so how can i know which ports are free and which are not?
If anybody can help me I would really appreciate it. If anyone knows any articles written about this please let me know.
thanx
regards,
Niroshan