str_echo.c
来自「linux下的聊天程序」· C语言 代码 · 共 28 行
C
28 行
//#include "unp.h"#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #define SERV_PORT 9877 #define LISTENQ 1024 #define MAXLINE 4096 #define SA struct sockaddrvoid str_echo(int sockfd){ ssize_t n; char line[MAXLINE]; for ( ; ; ) { if ( (n = Readline(sockfd, line, MAXLINE)) == 0) return; /* connection closed by other end */ Writen(sockfd, line, n); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?