dear sir,

i have implemented a TCP client in java. I'm using the ServerSocket. I always get an
connected with server port no and ip address .here is my code

try
{
Socket socket=new Socket(serverIP,serverport);
// System.out.println("Connected to sever..........");
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();

for(i=0;i<12;i++)
{
// System.out.println("sendbuffer" + ":" +Integer.toHexString(sendbuffer[i]));
out.write(sendbuffer[i]);
}
try{

Thread.sleep(500);
in.read(recvbuffer);
}catch(Exception e)
{
System.out.println(e);
}
for(i=0;i<33;i++)
{
// System.out.println("recvbuffer" + ":" +Integer.toHexString(recvbuffer[i]));
}
// System.out.println("Socket close..........");
in.close();
out.close();
socket.close();

}catch(IOException e)
{
System.out.println(e);
// JOptionPane.showMessageDialog(null,"please enter ip address");

}



Code:
Exception in thread "main" java.net.ConnectException: Connection timed out

at the client side. This occurs after numerous connections..

can you help me?