|
How to handle socket Exception
Sir i am running this code on windows vista, but i am getting the Socket Exception: Permission Denied:: Listen failed.I am trying to run this application on port 8080.On this very port i am running tomcat6.0,so even when i changed the port same exception arises.
Similar Exceptions were there when i run tomcat6.0 but when i installed tomcat6.0 as a service it worked fine.
So, please sir what should i do run this code on my machine.
I have Java SE(TM)Run Time Environment6 running, also mcafee antivirus running.Please post me a solution if possible
import java.io.IOException;
import java.net.*;
public class SocketTest
{
/**
* @param args
*/
public static void main(String[] args)
{
ServerSocket myService;
try
{
myService = new ServerSocket(8080);
System.out.println("successfully opened a socket");
}
catch (IOException e)
{
e.printStackTrace();
System.out.println(e);
}
}
}
|