Code example for Socket

Methods: getInputStream, getOutputStream, setTcpNoDelay

0
	if(socketFlag)
	{ 
		System.out.println("Preparing to sleep");
		Thread.sleep(500);
		System.out.println("slept, creating socket...");
		sockID = new Socket(theirIP, 22061);
		sockID.setTcpNoDelay(true);
	 
		outBuf = new PrintWriter(sockID.getOutputStream(),true);
		inBuf = new BufferedReader(new InputStreamReader(sockID.getInputStream()));
		System.out.println("socket created");
 
	} 
	else 
	{ 
		System.out.println("did not sleep, creating socket");
 
		sSockID = new ServerSocket(22061);
		System.out.println("preparing to accept");
 
		sockID=sSockID.accept();