List of usage examples for java.net Socket close
public synchronized void close() throws IOException
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); System.out.println(client.getReceiveBufferSize()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { InetAddress addr;/*from www .ja v a 2s . co m*/ Socket sock = new Socket(args[0], 80); addr = sock.getInetAddress(); System.out.println("Connected to " + addr); sock.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); System.out.println("Just connected to " + client.getRemoteSocketAddress()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setSoTimeout(1000);//from w w w .j a v a 2s .co m System.out.println(client.getSoTimeout()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setKeepAlive(true);/*from w w w . ja va2 s.com*/ System.out.println(client.getKeepAlive()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setTcpNoDelay(true);/*from ww w .j a v a 2 s. c om*/ System.out.println(client.getTcpNoDelay()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setSoLinger(true, 1000);//from w w w. j av a2 s . c o m System.out.println(client.getSoLinger()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80, true); System.out.println("Just connected to " + client.getRemoteSocketAddress()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setReuseAddress(true);//from w w w .ja v a 2s . co m System.out.println(client.getReuseAddress()); client.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Socket client = new Socket("google.com", 80); client.setSendBufferSize(1000);//from w w w . j a v a2 s . co m System.out.println(client.getSendBufferSize()); client.close(); }