[Beepcore-java-commits] CVS: beepcore-java/example/org/beepcore/beep/example Bing.java,1.5,1.6
Status: Beta
Brought to you by:
huston
From: Huston F. <hu...@us...> - 2001-10-31 16:15:49
|
Update of /cvsroot/beepcore-java/beepcore-java/example/org/beepcore/beep/example In directory usw-pr-cvs1:/tmp/cvs-serv5002/example/org/beepcore/beep/example Modified Files: Bing.java Log Message: Added error message Index: Bing.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/example/org/beepcore/beep/example/Bing.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Bing.java 2001/10/31 02:03:41 1.5 --- Bing.java 2001/10/31 16:15:47 1.6 *************** *** 18,24 **** --- 18,26 ---- import java.io.InputStream; + import java.io.IOException; import org.beepcore.beep.core.BEEPError; import org.beepcore.beep.core.BEEPException; + import org.beepcore.beep.core.BEEPInterruptedException; import org.beepcore.beep.core.Channel; import org.beepcore.beep.core.InputDataStream; *************** *** 90,98 **** } catch (BEEPError e) { if (e.getCode() == 550) { ! System.err.println("bing: Error host does not support echo " + ! "profile"); } else { System.err.println("bing: Error starting channel (" + ! e.getCode() + ": " + e.getMessage() + ")"); } return; --- 92,101 ---- } catch (BEEPError e) { if (e.getCode() == 550) { ! System.err.println("bing: Error host does not support " + ! "echo profile"); } else { System.err.println("bing: Error starting channel (" + ! e.getCode() + ": " + ! e.getMessage() + ")"); } return; *************** *** 105,119 **** String request = createRequest(size); ! try { ! for (int i=0; i<count; ++i) { ! long time; ! int replyLength = 0; ! Reply reply = new Reply(); ! time = System.currentTimeMillis(); // Send the request channel.sendMSG(new StringDataStream(request), reply); // Get the reply to the request InputDataStream ds = reply.getNextReply().getDataStream(); --- 108,128 ---- String request = createRequest(size); ! for (int i=0; i<count; ++i) { ! long time; ! int replyLength = 0; ! Reply reply = new Reply(); ! time = System.currentTimeMillis(); + try { // Send the request channel.sendMSG(new StringDataStream(request), reply); + } catch (BEEPException e) { + System.err.println("bing: Error sending request (" + + e.getMessage() + ")"); + return; + } + try { // Get the reply to the request InputDataStream ds = reply.getNextReply().getDataStream(); *************** *** 125,142 **** ++replyLength; } ! ! System.out.println("Reply from " + host + ": bytes=" + ! replyLength + " time=" + ! (System.currentTimeMillis() - time) + ! "ms"); } ! } catch (BEEPError e) { ! System.err.println("bing: Error sending request (" + e.getCode() + ! ": " + e.getMessage() + ")"); ! return; ! } catch (Exception e) { ! System.err.println("bing: Error sending request (" + ! e.getMessage() + ")"); ! return; } --- 134,151 ---- ++replyLength; } ! } catch (BEEPInterruptedException e) { ! System.err.println("bing: Error receiving reply (" + ! e.getMessage() + ")"); ! return; ! } catch (IOException e) { ! System.err.println("bing: Error receiving reply (" + ! e.getMessage() + ")"); ! return; } ! ! System.out.println("Reply from " + host + ": bytes=" + ! replyLength + " time=" + ! (System.currentTimeMillis() - time) + ! "ms"); } |