java.net.Socket.startupSocket()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.9k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中java.net.Socket.startupSocket()方法的一些代码示例,展示了Socket.startupSocket()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Socket.startupSocket()方法的具体详情如下:
包路径:java.net.Socket
类名称:Socket
方法名:startupSocket

Socket.startupSocket介绍

[英]Creates a stream socket, binds it to the nominated local address/port, then connects it to the nominated destination address/port.
[中]创建流套接字,将其绑定到指定的本地地址/端口,然后将其连接到指定的目标地址/端口。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: robovm/robovm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: robovm/robovm

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

代码示例来源:origin: robovm/robovm

try {
    checkDestination(dstAddress, dstPort);
    startupSocket(dstAddress, dstPort, localAddress, localPort, streaming);
    return;
  } catch (IOException ex) {
startupSocket(dstAddress, dstPort, localAddress, localPort, streaming);

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. The socket is
 * bound to any available port on the local host.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, null, 0, true);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates a new streaming socket connected to the target host specified by
 * the parameters {@code dstAddress} and {@code dstPort}. On the local
 * endpoint the socket is bound to the given address {@code localAddress} on
 * port {@code localPort}.
 *
 * @param dstAddress
 *            the target host address to connect to.
 * @param dstPort
 *            the port on the target host to connect to.
 * @param localAddress
 *            the address on the local host to bind to.
 * @param localPort
 *            the port on the local host to bind to.
 * @throws IOException
 *             if an error occurs while creating the socket.
 */
public Socket(InetAddress dstAddress, int dstPort,
    InetAddress localAddress, int localPort) throws IOException {
  this();
  checkDestination(dstAddress, dstPort);
  startupSocket(dstAddress, dstPort, localAddress, localPort, true);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates a new streaming or datagram socket connected to the target host
 * specified by the parameters {@code addr} and {@code port}. The socket is
 * bound to any available port on the local host.
 *
 * @param addr
 *            the Internet address to connect to.
 * @param port
 *            the port on the target host to connect to.
 * @param streaming
 *            if {@code true} a streaming socket is returned, a datagram
 *            socket otherwise.
 * @throws IOException
 *             if an error occurs while creating the socket.
 * @deprecated Use {@code Socket(InetAddress, int)} instead of this for
 *             streaming sockets or an appropriate constructor of {@code
 *             DatagramSocket} for UDP transport.
 */
@Deprecated
public Socket(InetAddress addr, int port, boolean streaming) throws IOException {
  this();
  checkDestination(addr, port);
  startupSocket(addr, port, null, 0, streaming);
}

相关文章