summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjava/netsvcs/Time/ClientTest.java94
-rwxr-xr-xjava/netsvcs/Time/TSClerkHandler.java7
-rwxr-xr-xjava/netsvcs/Time/TSServerHandler.java2
3 files changed, 6 insertions, 97 deletions
diff --git a/java/netsvcs/Time/ClientTest.java b/java/netsvcs/Time/ClientTest.java
deleted file mode 100755
index e5453d69243..00000000000
--- a/java/netsvcs/Time/ClientTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package netsvcs.Time;
-
-import JACE.SOCK_SAP.*;
-import java.io.*;
-import java.net.*;
-import JACE.OS.*;
-
-public class ClientTest {
-
- public static void main(String args[])
- {
- // Don't worry about processing command line right now
-
- int port = 7990;
-
- String host = new String("flamenco.cs.wustl.edu");
- // Why isn't the default defined?
-
-
- SOCKStream cli_stream = new SOCKStream();
-
- INETAddr remote_addr;
- try {
- remote_addr = new INETAddr(port, host);
- } catch (UnknownHostException uhe) {
- ACE.ERROR("UnknownHostException " + uhe);
- return;
- }
-
- SOCKConnector con = new SOCKConnector();
-
- ACE.DEBUG("Starting connect...");
-
- // Can't do non-blocking connect in Java! Yippee!
-
- try {
-
- con.connect(cli_stream, remote_addr);
-
- } catch (SocketException se) {
-
- ACE.ERROR("Socket Exception " + se);
- return;
-
- } catch (IOException ie) {
-
- ACE.ERROR("IOException " + ie);
- return;
- }
-
- String input; // need new string here?
- BufferedReader in
- = new BufferedReader(new InputStreamReader(System.in));
-
- try {
-
- do {
-
- input = in.readLine();
-
- if (input.equals("quit"))
- break;
-
- cli_stream.send(new StringBuffer(input + "\n"));
-
- StringBuffer result = new StringBuffer();
- int chars = cli_stream.recv(result);
- if (chars == -1)
- System.out.println("Evil!");
- else
- System.out.println(result);
-
- } while (true);
-
- // No close_writer, etc...
- cli_stream.close();
-
- } catch (IOException ie) {
-
- ACE.ERROR("IOException, loop: " + ie);
- return;
- }
- }
-};
-
-
-
-
-
-
-
-
-
-
diff --git a/java/netsvcs/Time/TSClerkHandler.java b/java/netsvcs/Time/TSClerkHandler.java
index 37f7629b44a..fc89b69c45c 100755
--- a/java/netsvcs/Time/TSClerkHandler.java
+++ b/java/netsvcs/Time/TSClerkHandler.java
@@ -52,7 +52,7 @@ public class TSClerkHandler extends SvcHandler
this.initialTimeout_ = timeout;
this.processor_ = parent;
- this.sendMsg_ = new String ("TIME_UPDATE_REQUEST\n");
+ this.sendMsg_ = new String ("TIME_UPDATE_REQUEST");
}
/**
@@ -202,12 +202,13 @@ public class TSClerkHandler extends SvcHandler
// Used to calculate the turn-around time
long sendTime = System.currentTimeMillis();
- this.peer ().send (this.sendMsg_);
+ this.peer ().send(this.sendMsg_);
ackLen = this.peer ().recv (ack);
long recvTime = System.currentTimeMillis();
if (ackLen <= 0) {
+
this.state_ = DISCONNECTED;
return -1;
@@ -218,6 +219,8 @@ public class TSClerkHandler extends SvcHandler
delta += (recvTime - sendTime) / 2;
this.delta_ = delta;
+
+ System.err.println("Delta: " + this.delta_);
}
}
diff --git a/java/netsvcs/Time/TSServerHandler.java b/java/netsvcs/Time/TSServerHandler.java
index 0fa940d2388..4ee700254ed 100755
--- a/java/netsvcs/Time/TSServerHandler.java
+++ b/java/netsvcs/Time/TSServerHandler.java
@@ -72,7 +72,7 @@ public class TSServerHandler extends SvcHandler
long time = System.currentTimeMillis();
// Send as a string
- this.peer ().send ("" + time + '\n');
+ this.peer ().send ("" + time);
ACE.DEBUG("Time: " + new Date(time));
}