*设为首页
*加入收藏
热门关键字: JAVA
>>当前位置:Java大本营>Socket编程>文章内容
secket 的几种构造方法
作者: 发布时间:2007-12-06 18:14:15

secket 的几种构造方法
  Socket()
          Creates an unconnected socket, with the system-default type of SocketImpl.
  Socket(InetAddress address, int port)
          Creates a stream socket and connects it to the specified port number at the specified IP address.
  Socket(InetAddress host, int port, boolean stream)
          Deprecated. Use DatagramSocket instead for UDP transport.
  Socket(InetAddress address, int port, InetAddress localAddr, int localPort)
          Creates a socket and connects it to the specified remote address on the specified remote port.
  Socket(Proxy proxy)
          Creates an unconnected socket, specifying the type of proxy, if any, that should be used regardless of any other settings.
protected Socket(SocketImpl impl)
          Creates an unconnected Socket with a user-specified SocketImpl.
  Socket(String host, int port)
          Creates a stream socket and connects it to the specified port number on the named host.
  Socket(String host, int port, boolean stream)
          Deprecated. Use DatagramSocket instead for UDP transport.
  Socket(String host, int port, InetAddress localAddr, int localPort)
          Creates a socket and connects it to the specified remote host on the specified remote port.

客户端连接服务器可能出现的异常

UnKnowHostException 无法识别主机或者ip地址
ConnectException 拒绝连接
sockettimeoutException 连接超时
bindException 无法绑定端口


·充分理解Socket(02-25)
·Socket编程指南及程序示例 (01-27)
·基于Java Socket的文件UpLoad代码 (12-07)
·java网络编程学习(12-06)
·Java网络服务器编程 (12-05)
·Java网络编程 (12-05)
·Java开发环境简介(12-05)
·Java网络编程学习笔记(12-05)
·基于Socket的Java网络编程(12-05)
·Java网络编程-用SSL构建安全的Socket (12-05)
·Java聊天程序的实现(12-04)
·简单的双向消息发送的聊天程序(java) (12-04)
复制地址发给您的好友: [推荐文章] [返回顶部] [关闭窗口]
版权所有 Java大本营 1999-2007 转载请注明出处