相关文章  
  • Linux操作系统编程之Shell问答录
  • 深入浅出分析Linux系统内核漏洞的问题(3)
  • Linux脚本开发数学库在PHP中的重要性(3)
  • Linux脚本开发数学库在PHP中的重要性(2)
  • 简述Linux操作系统文件搜索(下)
  • 用GNUprofiler提高代码运行速度 上
  • 用GNUprofiler提高代码运行速度 下
  • linux的域名解析系统设置
  • 学习Linux网络编程之二
  • 学习Linux网络编程之一
  •   推荐  
      科普之友首页   专利     科普      动物      植物        天文   考古   前沿科技
     您现在的位置在:  首页 >>文献 >>培训

    学习Linux网络编程之终结篇1

      5.2 一个实例

      /* 服务端程序 server.c */

      #include
      #include
      #include
      #include
      #include
      #define SERVER_PORT 8888
      #define MAX_MSG_SIZE 1024

      void udps_respon(int sockfd)
      {
      struct sockaddr_in addr;
      int addrlen,n;
      char msg[MAX_MSG_SIZE];

      while(1)
      { /* 从网络上度,写到网络上面去 */
      n=recvfrom(sockfd,msg,MAX_MSG_SIZE,0,
      (struct sockaddr*)&addr,&addrlen);
      msg[n]=0;

    页码:[1] [2] [3] [4] [5] [6] [7]1页、共7页

         

          设为首页       |       加入收藏       |       广告服务       |       友情链接       |       版权申明      

    Copyriht 2007 - 2008 ©  科普之友 All right reserved