当前位置:网站首页>UNIX socket advanced learning diary - advanced i/o functions

UNIX socket advanced learning diary - advanced i/o functions

2022-07-05 12:27:00 yang881221

1. Socket timeout

a. Use alarm-SIGALARM The signal

b.select Wait in the middle I/O

c. Use the socket option SO_RCVTIMEO,SO_SNDTIMEO.

stay connect and recvfrom Use in alarm

select Set timeout

Use the socket option to modify recvfrom

readv And writev function

Spread reading , Centralized writing

sendmsg,recvmsg

Secondary data


Check the amount of queued data :

Non blocking I/O

MSG_PEEK Peeping data

ioctl FIONREAD

Completely buffered : Buffer full , Process display call fflush, Or process call exit Terminate itself , Usually, it is 8k

The line buffer : Line break encountered , Process call fflush, Or process call exit Terminate itself

No buffer : Every time you call I/O Occurs from time to time I/O

/dev/poll

kqueue

Transaction purpose TCP


原网站

版权声明
本文为[yang881221]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140529242194.html