2017年9月16日

回射服务器的头文件

摘要: #ifndef _MY_ERR_H_#define _MY_ERR_H_ #include <errno.h> /* for definition of errno */#include <stdarg.h> /* ISO C variable aruments */ static void err 阅读全文

posted @ 2017-09-16 16:13 flyingwaters 阅读(301) 评论(0) 推荐(0) 编辑

回射服务器的客户端

摘要: #include "unp.h"int main(int argc,char**argv){ int sockfd; struct sockaddr_in servaddr; if(argc != 2) err_quit("usage:tcpcli<IPaddress>"); sockfd = so 阅读全文

posted @ 2017-09-16 16:12 flyingwaters 阅读(279) 评论(0) 推荐(0) 编辑

回射服务器的注释,全过程

摘要: #include "unp.h"static int read_cnt;//刚开始可以置为一个负值(我的理解) static char *read_ptr; static char read_buf[MAXLINE]; static ssize_t my_read(int fd, char *ptr 阅读全文

posted @ 2017-09-16 16:11 flyingwaters 阅读(372) 评论(0) 推荐(0) 编辑

fork()初级知识

摘要: 来自:http://blog.csdn.net/jason314/article/details/5640969 #include <unistd.h> #include <stdio.h> int main () { pid_t fpid; //fpid表示fork函数返回的值 int count 阅读全文

posted @ 2017-09-16 15:53 flyingwaters 阅读(135) 评论(0) 推荐(0) 编辑

socket编程之accept()函数

摘要: 转自:原文连接:http://linux.die.net/man/2/accept 名称 accept() 接收一个套接字中已建立的连接 使用格式 #include <sys/types.h> #include <sys/socket.h> int accept(int sockfd,struct 阅读全文

posted @ 2017-09-16 15:23 flyingwaters 阅读(1418) 评论(0) 推荐(0) 编辑

导航