Chinaunix首页 | 论坛 | 博客
  • 博客访问: 523844
  • 博文数量: 151
  • 博客积分: 7010
  • 博客等级: 少将
  • 技术积分: 1405
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-22 14:32
文章分类

全部博文(151)

文章存档

2011年(1)

2010年(23)

2009年(1)

2008年(126)

我的朋友

分类: Java

2008-06-04 16:26:28

一、TCP网络程序的工作原理


二、ServerSocket类
   1、构造函数:
     - public ServerSocket();//还要用bind函数来绑定
     - public ServerSocket(int port);//默认backlog=50
     - public ServerSocket(int port,int backlog);
       //backlog指定当服务器忙的时候可以与之保存连接的客户端等待的数量
     - public ServerSocket(int port,int backlog,InetAddress bindAddr);
   2、close()方法
   3、accept()方法
      等待客户端连接请求


三、Socket类
   1、构造函数:
     - public Socket();//还要用bind函数来绑定
     - public Socket(Stringhost,int port);
     - public Socket(InetAddress address,int port);
     - public Socket(String host,int port,InetAddress localAddr,int localPort);
     - public Socket(InetAddress addr,int port,InetAddress localAddr,int localPort);
   2、getInputStream和getOutputStream方法
阅读(829) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~