📄 asyncsocket.c
字号:
#include "apue.h"#include <errno.h>#include <fcntl.h>#include <sys/socket.h>#include <sys/ioctl.h>#if defined(BSD) || defined(MACOS) || defined(SOLARIS)#include <sys/filio.h>#endifintsetasync(int sockfd){ int n; if (fcntl(sockfd, F_SETOWN, getpid()) < 0) return(-1); n = 1; if (ioctl(sockfd, FIOASYNC, &n) < 0) return(-1); return(0);}intclrasync(int sockfd){ int n; n = 0; if (ioctl(sockfd, FIOASYNC, &n) < 0) return(-1); return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -