How does Synchronous and Asynchronous communication work exactly

后端 未结 2 2017
误落风尘
误落风尘 2021-01-30 01:45

I was trying to understand the terms Synchronous and Asynchronous communication but i am getting confused a bit. I tried to dig a bit into this but there are still confusions.

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 02:32

    synchronous your code sends a message, calls a function etc. and is blocked until an answer, a return value etc. arrives.

    asynchronous your code continues executing after sending a message/calling a function, you usually pass a reference to a callback function that executes when the answer arrives (can happen in an hour, couple of days, years), your main thread continues in the meantime.

提交回复
热议问题