Instantiating a socket can be done in various ways.
by 2 line declaration & instantiation:
First we need to define a variable which will hold a Socket class object:
Socket socket;
then we can create a Socket class object:
socket = new Socket();
We can also make a one line defin...
public class ConnectSocketExample {
private int HTTP_PORT = 80;
/**
* example method to create unconnected socket
* then connect to it
* at end return connected socket
*
* @param httpHostName - endpoint host name fot socket connection
* @throws IOEx...
/**
* we reuse a class written in example:
* http://stackoverflow.com/documentation/sockets/2876/introduction-to-sockets#t=201607262114505531351
* pleas to familiar with it first to continue with this one
**/
public class WriteToSocketExample extends ConnectSocketExample {
private ...