Java Utililty Methods Socket Create

List of utility methods to do Socket Create

Description

The list of methods to do Socket Create are organized into topic(s).

Method

SocketcreateSocket(String host, int port)
create Socket
return new Socket(host, port);
voidcreateSocket(String[] hostPort)
create Socket
String address = hostPort[0];
Integer port = Integer.valueOf(hostPort[1]);
Socket s = new Socket(address, port);
s.close();
InetSocketAddresscreateSocketAddr(String addr)
create Socket Addr
String[] splitted = addr.split(":");
return new InetSocketAddress(splitted[0], Integer.parseInt(splitted[1]));
InetSocketAddresscreateSocketAddr(String target)
Util method to build socket addr from either: : ://:/
return createSocketAddr(target, null);
InetSocketAddresscreateSocketAddr(String target)
create Socket Addr
return createSocketAddr(target, 8080);
SocketAddresscreateSocketAddress()
create Socket Address
return new InetSocketAddress(HOST, PORT);
SocketAddresscreateSocketAddress(String server)
create Socket Address
String[] serverSplit = server.split(":");
String hostname = serverSplit[0];
int port = Integer.parseInt(serverSplit[1]);
return new InetSocketAddress(hostname, port);
InetSocketAddresscreateSocketAddrForHost(String hostName, int port)
create Socket Addr For Host
return null;
ServerSocketcreateSocketServer(int port)
create socket server by default port
return new ServerSocket(port);
SocketgetSocket()
Return the user socket
return clientSocket;