您的位置:首页 > 编程语言 > C语言/C++

c语言多进程tcp服务器示例

2014-03-06 10:31 976 查看
#ifndef SERVER_H#define SERVER_H#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <arpa/inet.h>#include <assert.h>#include <sys/epoll.h>#include <signal.h>#include <fcntl.h>#include "bussiness.h"#define LISTENTQ 5#define DEF_PORT 6000#define MAX_EPOLL_SIZE 10#define DEF_PROCESS_NUM 5int create_tcpsvr(char *ip, int port);void fill_sockaddr(struct sockaddr_in *addr,char *ip, int port);void comm_to_client(int sockfd);void epoll_business(int epollfd, int listenfd, struct epoll_event ev);int init_epoll(int listenfd); void create_process(int sockfd, int i);#endif
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息