Results 1 to 1 of 1
  1. #1
    Yogesh_P is offline Member
    Join Date
    Mar 2011
    Rep Power

    Default How to keep trying to other machine with exceptional handling


    I am trying to connect to machine in client-server model such that client should keep trying sending request to server until it gets a response from server and not just throw an exception, how can I handle that. Here the thing is that machine P0 may not be put when P1 is trying but will be run in few sec, so I need to keep trying that.

    Here's what I am doing

    Java Code:
    while(P1Ack != 1)
    public void P1connectsP0()
    	{[0] = "init";[1] = pid;
    			clientSock = new Socket(lamport.P0Ip, lamport.P0Port);
    			lamport.log( +" ("+lamport.myIp+") "+ " is connecting to P0 ("+ lamport.P0Ip + ")" );
    			clientWriter = new ObjectOutputStream(clientSock.getOutputStream());
    			clientReader = new ObjectInputStream(clientSock.getInputStream());
    		catch(IOException ex)
    			System.out.println("Error : P1 unable to talk to P0");
    Where P1 wants to keep trying to contact with P0. But it just keeps looping by throwing exceptions
    Last edited by Yogesh_P; 03-30-2011 at 05:28 PM.

Similar Threads

  1. Replies: 0
    Last Post: 02-07-2011, 02:27 PM
  2. machine epsilon
    By rosh72851 in forum Advanced Java
    Replies: 9
    Last Post: 09-24-2008, 03:16 AM
  3. machine epsilon
    By rosh72851 in forum New To Java
    Replies: 2
    Last Post: 09-23-2008, 10:21 PM
  4. 32 bit machine or 64 bit machine
    By Kapil Gupta in forum Advanced Java
    Replies: 13
    Last Post: 06-24-2008, 03:29 AM
  5. Getting name/ip of a machine
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-02-2008, 08:11 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