questions about multi threading for sockets/tcp-connections.
Posted
by Fantastic Fourier
on Stack Overflow
See other posts from Stack Overflow
or by Fantastic Fourier
Published on 2010-03-20T21:50:05Z
Indexed on
2010/03/20
22:01 UTC
Read the original article
Hit count: 368
I have a server that connects to multiple clients using TCP/IP connections, using C in Unix. Since it won't have more than 20 connections at a time, I figured I would use a thread per connection/socket. But the problem is writing to the sockets as I'll be sending user prompted msgs to clients. Once each socket is handled by a thread, how do I interact with the created thread to write to the sockets? Should each thread just read from the sockets and I'll write to sockets in the main program? Not sure if that's a good way to go about it.
© Stack Overflow or respective owner