Hi all.
Im having a problem with my project.
I need that my socket recive multiple conections from differents pcs.
Example:
I have my socket, it is listening, when a pc connect to its, it stop listen, so there come the second computer trying to connect, and this computer cant doit beacuse socket isnt listening anymore.
I tried, putting the socket to listen, when anybody connects to it, the code makes another socket and it puts it in listen mode. The problem is that when i run the program there is an error and it shows that i cant have 2 sockets on the same port.
Thanks

Recommended Answers

All 3 Replies

This should help you.

The basic idea is this:

Each port can only have 1 passive listening socket, but many active sockets.

You code must listen for connections on the port, when one is detected, it must create a new socket to handle the active connection and then go back to passively listening for another connection.

Google will give a lot of code examples of this.

Thanks i could do it with a tcplistener.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.