try { ServerSocket server = new ServerSocket(9089); Socket socket = server.accept(); OutputStream out = socket.getOutputStream(); out.write(12); out.flush(); System.out.println("Data Sent...."); Thread.sleep(5000); } catch(Exception e) { System.out.println("Server Error : " + e.toString()); }
try { Socket client = new Socket(InetAddress.getLocalHost(), 9089); System.out.println("Connected ...."); InputStream in = client.getInputStream(); while(in.available()>0) { System.out.println("Unavailable..."); } System.out.println("Received : " + in.read() ); in.close(); } catch(Exception e) { System.out.println("Sender Error : " + e.toString()); }
while(in.available()>0)
while(in.available()==0)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)