FileDocCategorySizeDatePackage
SockStreamLogger.javaAPI DocExample1327Wed Mar 22 16:06:54 GMT 2000tuning.socket

SockStreamLogger

public class SockStreamLogger extends Object

Fields Summary
public static boolean
LOG_SIZE
public static boolean
LOG_MESSAGE
public static long
DELAY
public static long
READ_DELAY
public static int
WriteCount
public static int
ReadCount
public static int
WriteSize
public static int
ReadSize
Constructors Summary
Methods Summary
public static voidlog(boolean isWritten, java.net.Socket so, int sz, byte[] buf, int off)

              
  
	if (LOG_SIZE)
	{
		System.err.print("Message of size ");
		System.err.print(sz);
		System.err.print(isWritten ? " written" : " read");
		System.err.print(" by Socket ");
		System.err.println(so);
	}
	if (LOG_MESSAGE)
	  System.err.println(new String(buf, off, sz));
  
public static voidread(java.net.Socket so, int sz, byte[] buf, int off)

    log(false, so, sz, buf, off);
    ReadCount++;
    ReadSize += sz;
    if(READ_DELAY != -1) try{Thread.sleep(READ_DELAY);}catch(Exception e){}
  
public static voidwritten(java.net.Socket so, int sz, byte[] buf, int off)

    log(true, so, sz, buf, off);
    WriteCount++;
    WriteSize += sz;
    if(DELAY != -1) try{Thread.sleep(DELAY);}catch(Exception e){}