3 ms·
I can't speak for all of HN, but I can speak for me. I maintain a library for a language that does network comms. All the calls are simply passed to another b
by bruce511 3y ago
I can't speak for all of HN, but I can speak for me.
I maintain a library for a language that does network comms.
All the calls are simply passed to another background thread, and the code in the calling thread keeps going. In other words all the commands are non blocking.
That's for outgoing. For incoming a message is sent to the originating thread (actually to the originating object on the originating thread) and the object can the process the incoming at their convenience.
For me this is async. The request and the response are disconnected in the running code. You might request here, but the response appears over there.
It's easier to understand on the server side. There the object is just chilling, and suddenly a message arrives out of nowhere to alert to an incoming packet.
Sync comms "blocks" the program until the reply arrives. This could take milliseconds, or minutes, depending on what you are asking for. Which means your program is unresponsive in this time.