• Thursday, September 25, 2014

    Java, Android - Set time out while connecting using Socket with IP Address

    How to set time while connecting  using socket with provided IP Address


    /*
    Import these files:

    import java.net.InetSocketAddress;
    import java.net.Socket;
    import java.net.ServerSocket;

    */

    public void connect(String IPAddress,int port,int timeOut) throws Exception
    {
    SocketAddress sa=InetSocketAddress(IPAddress,port);
    Socket s=new Socket();
    s.connect(sa,timeOut);
    }

    Syed Masoom Rizvi

    Author & Editor

    Hi, This is Syed Masoom Rizvi, who is continue exploring the world of programming ,programming and programming... :)

    0 comments:

    Post a Comment