Monitoring Port 80

I'm writing a java program to monitor port 80 & retrieve the bytes that pass through that port. For this, i wrote the following code.

Socket sc=new Socket(InetAddress.getLocalHost(),80);

BufferedReader in=new BufferedReader(new InputStreamReader(sc.getInputStream()));

String s="";

while ( (s=br.readLine()) !=null )

{

System.out.println(s);

}

However, when i run the program, it prints out nothing & just exits. What should i do?

[737 byte] By [Aswina] at [2007-10-2 4:48:16]
# 1
Use something other than Java. You can't do a port monitor using Java, it only knows about its own i/o.
ChuckBinga at 2007-7-16 0:52:59 > top of Java-index,Administration Tools,Sun Connection...
# 2
I need the java code for monitoring the ports. If I use the ServerSocket, i will make the connection between client. that is it will catch the connection. so,please solve my problem on java
akgdeena at 2007-7-16 0:52:59 > top of Java-index,Administration Tools,Sun Connection...
# 3
You can easily write a port-forwarder in Java.
BIJ001a at 2007-7-16 0:52:59 > top of Java-index,Administration Tools,Sun Connection...