/** * Return a client socket, timing out if unable to connect and timeout > 0 (millis). * The parameter <i>timeout</i> is ignored if SSL is being used, as there is no * timeout argument in the ssl socket factory */ public Socket connect(InetAddress inetadd, int port, int timeout, ConnectionWatcher optionalWatcher, boolean clientSide) throws IOException { return connect(inetadd, port, timeout, optionalWatcher, clientSide, -1); }
/** Return a client socket. This method is used by peers. */ public Socket connectForServer( InetAddress inetadd, int port ) throws IOException { return connect(inetadd, port, 0, null, false, -1); }
/** * Return a client socket. This method is used by peers. */ public Socket connectForServer(InetAddress inetadd, int port, GFLogWriter log) throws IOException { return connect(inetadd, port, log, 0, null, false, -1, this.useSSL); }
/** * Return a client socket. This method is used by peers. */ public Socket connectForServer(InetAddress inetadd, int port, GFLogWriter log, int socketBufferSize) throws IOException { return connect(inetadd, port, log, 0, null, false, socketBufferSize, this.useSSL); }
/** * Return a client socket, timing out if unable to connect and timeout > 0 (millis). * The parameter <i>timeout</i> is ignored if SSL is being used, as there is no * timeout argument in the ssl socket factory */ public Socket connect(InetAddress inetadd, int port, int timeout, ConnectionWatcher optionalWatcher, boolean clientSide, int socketBufferSize) throws IOException { return connect(inetadd, port, timeout, optionalWatcher, clientSide, socketBufferSize, this.useSSL); }
/** * Return a client socket, timing out if unable to connect and timeout > 0 (millis). * The parameter <i>timeout</i> is ignored if SSL is being used, as there is no * timeout argument in the ssl socket factory */ @Override public Socket connect(InetAddress inetadd, int port, GFLogWriter log, int timeout, ConnectionWatcher optionalWatcher, boolean clientSide) throws IOException { return connect(inetadd, port, log, timeout, optionalWatcher, clientSide, -1, this.useSSL); }
/** Return a client socket. This method is used by peers. */ public Socket connectForServer( InetAddress inetadd, int port, int socketBufferSize ) throws IOException { return connect(inetadd, port, 0, null, false, socketBufferSize); }
/** Return a client socket. This method is used by client/server clients. */ public Socket connectForClient( String host, int port, int timeout, int socketBufferSize ) throws IOException { return connect( InetAddress.getByName( host ), port, timeout, null, true, socketBufferSize ); }
/** Return a client socket. This method is used by client/server clients. */ public Socket connectForClient( String host, int port, int timeout ) throws IOException { return connect( InetAddress.getByName( host ), port, timeout, null, true, -1 ); }
/** * Return a client socket. This method is used by client/server clients. */ public Socket connectForClient(String host, int port, GFLogWriter log, int timeout) throws IOException { return connect(InetAddress.getByName(host), port, log, timeout, null, true, -1, this.useSSL); }
/** * Return a client socket. This method is used by client/server clients. */ public Socket connectForClient(String host, int port, GFLogWriter log, int timeout, int socketBufferSize) throws IOException { return connect(InetAddress.getByName(host), port, log, timeout, null, true, socketBufferSize, this.useSSL); }
Socket sock=SocketCreator.getDefaultInstance().connect(ipAddr.getAddress(), ipAddr.getPort(), timeout, null, false); sock.setSoTimeout(timeout);
/** * During final check, establish TCP connection between current member and suspect member. * And exchange PING/PONG message to see if the suspect member is still alive. * * @param suspectMember member that does not respond to HeartbeatRequestMessage * @return true if successfully exchanged PING/PONG with TCP connection, otherwise false. */ private boolean doTCPCheckMember(InternalDistributedMember suspectMember, int port) { Socket clientSocket = null; try { logger.debug("Checking member {} with TCP socket connection {}:{}.", suspectMember, suspectMember.getInetAddress(), port); clientSocket = SocketCreator.getDefaultInstance().connect(suspectMember.getInetAddress(), port, (int)memberTimeout, new ConnectTimeoutTask(services.getTimer(), memberTimeout), false, -1, false); clientSocket.setTcpNoDelay(true); return doTCPCheckMember(suspectMember, clientSocket); } catch (IOException e) { logger.debug("Unexpected exception", e); } finally { try { if (clientSocket != null) { clientSocket.close(); } } catch (IOException e) { logger.trace("Unexpected exception", e); } } return false; }
Socket sock=SocketCreator.getDefaultInstance().connect(ipAddr.getAddress(), ipAddr.getPort(), (int)newTimeout, null, false); sock.setSoTimeout((int)newTimeout); DataOutputStream out = null;
Socket sock=SocketCreator.getDefaultInstance().connect(ipAddr.getIpAddress(), ipAddr.getPort(), LOG.getLogWriter(), timeout, null, false); sock.setSoTimeout(timeout);
Socket sock=SocketCreator.getDefaultInstance().connect(ipAddr.getIpAddress(), ipAddr.getPort(), LOG.getLogWriter(), timeout, null, false); sock.setSoTimeout(timeout);