- 1 void str_cli(FILE * fp, int sockfd) 2 {
- 3 char sendline[MAXLINE],
- recvline[MAXLINE];
- 4 5
- while (Fgets(sendline, MAXLINE, fp) != NULL) 6 {
- 7 Writen(sockfd, sendline, 1);
- 8 Sleep(1);
- 9 Writen(sockfd, sendline, strlen(sendline) - 1);
- 10
- if (Readline(sockfd, recvline, MAXLINE) == 0) 11 {
- 12 err_quit("str_cli: server terminated prematurely");
- 13
- }
- 14 Fputs(recvline, stdout);
- 15
- }
- 16
- }
来源: http://www.bubuko.com/infodetail-2024394.html