if ( (childpid = Fork()) == 0) { /* child process */
//Close(listenfd); /* close listening socket */
//str_echo(connfd); /* process the request */
exit(0);
}
//Close(connfd); /* parent closes connected socket */
}
}
编译的时候,老是报一大堆错误,然而把文件上传到linux机器上编译是正确的。在windows上报错:
g++ tcpserv01.c -o main
In file included from C:/cygwin/usr/include/asm/socket.h:14,
from C:/cygwin/usr/include/cygwin/socket.h:45,
from C:/cygwin/usr/include/sys/socket.h:15,(这里连续3个和socket.h相关的话,是什么意思???)
from tcpserv01.c:2:
C:/cygwin/usr/include/cygwin/if.h:79: error: `caddr_t' does not name a type
In file included from C:/cygwin/usr/include/sys/socket.h:15,
from tcpserv01.c:2:
C:/cygwin/usr/include/cygwin/socket.h:52: error: `__uid32_t' does not name a type
C:/cygwin/usr/include/cygwin/socket.h:53: error: `__gid32_t' does not name a type
In file included from C:/cygwin/usr/include/sys/wait.h:15,
from tcpserv01.c:17:
C:/cygwin/usr/include/sys/resource.h:76: error: `id_t' has not been declared
C:/cygwin/usr/include/sys/resource.h:77: error: `id_t' has not been declared