lw_ip 的 recv function flag 參數有一個 MSG_PEEK.
資料可以保留在 recv buffer 中, 下次 recv() 時再取出.
MSG_OOB | Receive Out of Band data. This is how to get data that has been sent to you with the MSG_OOBflag in send(). As the receiving side, you will have had signal SIGURG raised telling you there is urgent data. In your handler for that signal, you could call recv() with this MSG_OOB flag. |
MSG_PEEK | If you want to call recv() "just for pretend", you can call it with this flag. This will tell you what's waiting in the buffer for when you call recv() "for real" (i.e. without the MSG_PEEKflag. It's like a sneak preview into the next recv() call. |
MSG_WAITALL | Tell recv() to not return until all the data you specified in the len parameter. It will ignore your wishes in extreme circumstances, however, like if a signal interrupts the call or if some error occurs or if the remote side closes the connection, etc. Don't be mad with it. |
留言
張貼留言