بلاگی در مورد دیجیتال،بینایی و یادگیری ماشین

اکانت های من:
www.github.com/salehjg
www.iranled.com/forum

طبقه بندی موضوعی

۱ مطلب با کلمه‌ی کلیدی «LwIP» ثبت شده است

نوشته ای مفید در مورد حالت non-blocking در LwIP

دوشنبه, ۱۹ تیر ۱۳۹۶، ۰۲:۵۶ ق.ظ

By default, TCP sockets are in "blocking" mode. For example, when you call recv() to read from a stream, control isn't returned to your program until at least one byte of data is read from the remote site. This process of waiting for data to appear is referred to as "blocking". The same is true for the write() API, the connect() API, etc. When you run them, the connection "blocks" until the operation is complete.


Its possible to set a descriptor so that it is placed in "non-blocking" mode. When placed in non-blocking mode, you never wait for an operation to complete. This is an invaluable tool if you need to switch between many different connected sockets, and want to ensure that none of them cause the program to "lock up."


If you call "recv()" in non-blocking mode, it will return any data that the system has in it's read buffer for that socket. But, it won't wait for that data. If the read buffer is empty, the system will return from recv() immediately saying ``"Operation Would Block!"''. "


However, the provided Blackin lwIP port does not support non-blocking recv function calls.

۰ نظر موافقین ۰ مخالفین ۰ ۱۹ تیر ۹۶ ، ۰۲:۵۶
صالح جمالی