随笔分类 -  Linux学习

摘要:服务器端#include #include #include #include #include #include #define MAXLINE 80#define SERV_PORT 8888void do_echo( int sockfd, struct sockaddr *pcliaddr, socklen_t client ){ int n; socklen_t len; char mesg[80]; while (1) { len = client; n = recvfrom( sockfd, mesg, 80, 0, pc... 阅读全文
posted @ 2013-11-11 21:10 冰鸮 阅读(580) 评论(2) 推荐(0)
摘要:服务器端代码#include #include #include #include #include #include #include #include #include #include int main( int argc, char *argv[] ){ int sockfd, new_fd; struct sockaddr_in server_addr; struct sockaddr_in client_addr; int sin_size, portnumber; const char hello[] = "Hello!\n"; if ( ar... 阅读全文
posted @ 2013-11-11 20:16 冰鸮 阅读(570) 评论(0) 推荐(0)