Alex Paluch

Alex Paluch

  • NA
  • 1
  • 0

Best threading model in a small chatserver?

Jan 9 2006 8:13 PM
Hello,

i'm implementig a small chat server to learn sockets and thread programming. the chat server will use tcp as connection model (using tcplistener / tcpclient). As there will be several clients connected to the server, i will have to implement some multithreading model.

question: will asynchronous calls to Networkstream.BeginReceive() do the job? What happens if BeginReceive was called and I start a simultaneous sending transmission on the same socket?

Or will it be better to use the Synchronous Method Networkstream.Receive in a method which is being called a a seperate thread? Would the BackgroundWorker Class be a good solution? (Never used it).

Thanks for any help!
Cheers, alex




Answers (2)