Code example for Socket

Methods: closeconnect

 * @author schreib 
public final class HttpRequest 
	public static String issueRequest(String targetHost, int targetPort, String forPlayerName, String requestContent, int timeoutClock) throws IOException {
		Socket socket = new Socket();
    	InetAddress theHost = InetAddress.getByName(targetHost);    	
    	socket.connect(new InetSocketAddress(theHost.getHostAddress(), targetPort), 5000);
    	HttpWriter.writeAsClient(socket, theHost.getHostName(), requestContent, forPlayerName);
    	String response = (timeoutClock < 0) ? HttpReader.readAsClient(socket) : HttpReader.readAsClient(socket, timeoutClock);
    	return response;
Connect your IDE to all the code out there  Get Codota for Java