当前位置:我的异常网» C语言 » linux c 多进程的服务器客户端 socket operation on
linux c 多进程的服务器客户端 socket operation on non-socket解决思路
www.myexceptions.net 网友分享于:2015-08-26 浏览:0次
linux c 多进程的服务器客户端 socket operation on non-socket
server.c:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
int client_sockfd,server_sockfd;
pid_t pid;
int client_len,server_len;
struct sockaddr_in client_add,server_add;
if((server_sockfd = socket(AF_INET,SOCK_STREAM,0)) == -1){//创建服务端socket
perror ("socket create fail");
exit (EXIT_FAILURE);
}
bzero(&server_add,sizeof(server_add));
server_add.sin_family = AF_INET;
server_add.sin_addr.s