Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello everyone,

I'm now programming a socket server for my applications' communications. I want my threading pattern to implement a server that can allow multiple requests at the same time (not waiting as a sequential queue does). I've come across the Blocking property too. What's different between these two?

Thanks!
Posted
Updated 25-Mar-10 6:16am
v3

1 solution

Primarily, the difference between a multithreaded socket server and a non-blocking is pretty subtle.

In both cases, multi-threading is involved. The main difference lies in the handling of the request.

In a Multi-threaded server, once a request is received, the rest of the operation(s) which include everything from transferring data to processing is then thrown to another thread which takes it from there and handles all of the work and finally closes the connection (hopefully in a graceful manner).

A non-blocking server has one thread that listens on the port and when a request is made it then delegates a specific task to a "background" thread so that operation of that thread can continue and not be blocked by a long running (possibly failing) function.

Did that explain it well enough?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900