Results 1 to 5 of 5
  1. #1
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default connection timed out in my java code

    dear sir

    i have develped my GUI,it has two buttons such as start-tx-rx and stop.

    once i press the start-tx-rx ,continously recevice the data ,my c code always in listen mode.after one hour i am getting connection timed out message and stops the connection.

    thanks
    santhosh

  2. #2
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default

    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?

  3. #3
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default

    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?

  4. #4
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default

    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?

  5. #5
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default

    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?

Similar Threads

  1. Convert java code to midlet code
    By coldvoice05 in forum New To Java
    Replies: 1
    Last Post: 08-12-2009, 12:14 PM
  2. Timed alerts in JTable
    By Hikari in forum New To Java
    Replies: 2
    Last Post: 01-03-2009, 01:50 AM
  3. Replies: 1
    Last Post: 06-30-2008, 08:14 AM
  4. Replies: 1
    Last Post: 08-07-2007, 07:03 AM
  5. Replies: 1
    Last Post: 07-27-2007, 11:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •