Establishing a connection

Top  Previous  Next

You may establish a connection to any TCP server by creating a new IpClient instance providing hostname and port as arguments to the constructor and invoking the IpClient#connect method. 

 

Example

 

// create new IpClient instance

IpClient client = new IpClient("www.server.com",80);

 

// establish connection

client.connect();

 

Example

 

// create new IpClient instance with 5 second connection timeout

IpClient client = new IpClient("www.server.com",80,5000);

 

// establish connection

client.connect();