Package java.net

Examples of java.net.Socket.connect()


        }

        @Override
        public Socket createSocket(final InetAddress host, final int port) throws IOException {
            final Socket socket = createSocket();
            socket.connect(new InetSocketAddress(host, port));
            return socket;
        }

        @Override
        public Socket createSocket(final String host, final int port, final InetAddress localHost, final int localPort) throws IOException {
View Full Code Here


        @Override
        public Socket createSocket(final InetAddress address, final int port, final InetAddress localAddress, final int localPort) throws IOException {
            final Socket socket = createSocket();
            socket.bind(new InetSocketAddress(localAddress, localPort));
            socket.connect(new InetSocketAddress(address, port));
            return socket;
        }

        @Override
        public Socket createSocket(final String name) {
View Full Code Here

        }

        @Override
        public Socket createSocket(final String name, final InetAddress host, final int port) throws IOException {
            final Socket socket = createSocket(name);
            socket.connect(new InetSocketAddress(host, port));
            return socket;
        }

        @Override
        public Socket createSocket(final String name, final String host, final int port, final InetAddress localHost, final int localPort) throws IOException {
View Full Code Here

        @Override
        public Socket createSocket(final String name, final InetAddress address, final int port, final InetAddress localAddress, final int localPort) throws IOException {
            final Socket socket = createSocket(name);
            socket.bind(new InetSocketAddress(localAddress, localPort));
            socket.connect(new InetSocketAddress(address, port));
            return socket;
        }

    }
View Full Code Here

         timeout = getTimeout();
         if (timeout < 0)
            timeout = 0;
      }
     
      s.connect(inetAddr, timeout);

      return s;
   }

   protected SocketWrapper getPooledConnection()
View Full Code Here

        if (thread == null) {
            throw MESSAGES.threadCreationRefused();
        }
        if (bindAddress != null) socket.bind(bindAddress);
        if (readTimeout != 0) socket.setSoTimeout(readTimeout);
        socket.connect(serverAddress, connectTimeout);
        thread.setName("Read thread for " + serverAddress);
        thread.start();
        CLIENT_LOGGER.tracef("Connected to %s", serverAddress);
        return connection;
    }
View Full Code Here

        socket.setTcpNoDelay(true);

        try {
            final int openTimeout = configManager.
                getDuration(RepParams.REPSTREAM_OPEN_TIMEOUT);
            socket.connect(repNode.getMasterStatus().getNodeMaster(),
                           openTimeout);
            ServiceDispatcher.doServiceHandshake
                (channel, FeederManager.FEEDER_SERVICE);
        } catch (ConnectException e) {
View Full Code Here

            PrintWriter out = null;
            try {
                socket.setSoTimeout(readTimeoutMs);
                socket.setTcpNoDelay(true);
                socket.setReuseAddress(true);
                socket.connect(target, openTimeoutMs);
                OutputStream ostream =
                    ServiceDispatcher.getServiceOutputStream(socket,
                                                             serviceName);
                out = new PrintWriter(ostream, true);
                out.println(requestMessage.wireFormat());
View Full Code Here

    public Socket connect() throws IOException {
        final Socket socket = this.createSocket();
        final InetAddress destinationAddress = this.getDestinationAddress();
        final int destinationPort = this.getDestinationPort();
        final SocketAddress destination = new InetSocketAddress(destinationAddress, destinationPort);
        socket.connect(destination);

        return socket;
    }

    /**
 
View Full Code Here

         timeout = getTimeout();
         if (timeout < 0)
            timeout = 0;
      }
     
      s.connect(inetAddr, timeout);

      if (s instanceof SSLSocket)
      {
         // need to check for handshake listener and add them if there is one
         Object obj = configuration.get(Client.HANDSHAKE_COMPLETED_LISTENER);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.