Skip to content

Instantly share code, notes, and snippets.

@vanjikumaran
Created August 12, 2013 12:26
Show Gist options
  • Select an option

  • Save vanjikumaran/6210394 to your computer and use it in GitHub Desktop.

Select an option

Save vanjikumaran/6210394 to your computer and use it in GitHub Desktop.
import java.io.*;
import java.net.*;
/**
* Created with IntelliJ IDEA.
* User: vanji
* Date: 5/17/13
* Time: 9:31 AM
* To change this template use File | Settings | File Templates.
*/
public class Client{
public static void main(String[] args) throws Exception
{
Socket socket = new Socket(InetAddress.getByName("localhost"), 12345);
InputStream in = socket.getInputStream();
int c;
while ((c = in.read()) != -1)
{
System.out.write(c);
}
System.out.flush();
// should now be in CLOSE_WAIT
Thread.sleep(Integer.MAX_VALUE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment