Package java.net

Examples of java.net.Socket.bind()


        String tmp_state_id = hdr.getStateId();
        InputStream bis = null;
        StateTransferInfo sti = null;
        Socket socket = new Socket();
        try {
            socket.bind(new InetSocketAddress(bind_addr, 0));
            int bufferSize = socket.getReceiveBufferSize();
            socket.setReceiveBufferSize(socket_buffer_size);
            if (log.isDebugEnabled())
                log.debug("Connecting to state provider " + address.getIpAddress() + ":"
                        + address.getPort() + ", original buffer size was " + bufferSize
View Full Code Here


                             InetAddress localAddr, int localPort,
                             int timeout) throws IOException {
    Socket socket = new Socket();
    InetSocketAddress endpoint = new InetSocketAddress(addr, port);
    InetSocketAddress bindpoint = new InetSocketAddress(localAddr, localPort);
    socket.bind(bindpoint);
    socket.connect(endpoint, timeout);

    return socket;
  }
}
View Full Code Here

                    Socket socket = new Socket();
                   
                    String  result = a_str;
                   
                    try{
                      socket.bind( new InetSocketAddress( ia, 0 ));
                                               
                      socket.connectnew InetSocketAddress( "www.google.com", 80 ), 10*1000 );
                     
                      result += "*";
                     
 
View Full Code Here

      try{
          Socket socket = new Socket();
          
          if ( bind_ip != null ){
           
            socket.bind( new InetSocketAddress( bind_ip, bind_port ));
           
          }else if ( bind_port != 0 ){
           
            socket.bind( new InetSocketAddress( bind_port ));
          }
View Full Code Here

           
            socket.bind( new InetSocketAddress( bind_ip, bind_port ));
           
          }else if ( bind_port != 0 ){
           
            socket.bind( new InetSocketAddress( bind_port ));
          }
         
          socket.setSoTimeout( 10000 );
       
          socket.connect( new InetSocketAddress( "www.google.com", 80 ), 10000 );
View Full Code Here

    {
      Socket socket = socketfactory.createSocket();
      SocketAddress localaddr = new InetSocketAddress(localAddress,
          localPort);
      SocketAddress remoteaddr = new InetSocketAddress(host, port);
      socket.bind(localaddr);
      socket.connect(remoteaddr, timeout);
      return socket;
    }
  }
View Full Code Here

    /* Timeout is defined */
    Socket socket = socketfactory.createSocket();
    SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
    SocketAddress remoteaddr = new InetSocketAddress(host, port);
    socket.bind(localaddr);
    socket.connect(remoteaddr, timeout);
    return socket;
  }

  /*
 
View Full Code Here

            return socketfactory.createSocket(host, port, localAddress, localPort);
        } else {
            Socket socket = socketfactory.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
            socket.bind(localaddr);
            socket.connect(remoteaddr, timeout);
            return socket;
        }
    }
View Full Code Here

                InetSocketAddress addr = new InetSocketAddress(InetAddress.getByName(remoteHost), remotePort);
                channel = SocketChannel.open(addr);
            } else {
                channel = SocketChannel.open();
                Socket socket = channel.socket();
                socket.bind(new InetSocketAddress(InetAddress.getByName(localHost), localPort));
                socket.connect(new InetSocketAddress(InetAddress.getByName(remoteHost), remotePort));
            }
            channel.finishConnect();
            initSocket(context.getRuntime(), new ChannelDescriptor(channel, RubyIO.getNewFileno(), new ModeFlags(ModeFlags.RDWR), new FileDescriptor()));
        } catch (InvalidValueException ex) {
View Full Code Here

        if ( params == null )
            return createSocket( sHost, nPort, aLocalAddress, nLocalPort );

        int nTimeout = params.getConnectionTimeout();
        Socket aSocket = GetNotSoSecureSSLContext().getSocketFactory().createSocket();
        aSocket.bind( new InetSocketAddress( aLocalAddress, nLocalPort ) );
        aSocket.connect( new InetSocketAddress( sHost, nPort ), nTimeout );
        return aSocket;
    }

    public Socket createSocket( String sHost, int nPort )
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.