dfs 2002/09/17 15:02:32
Modified: net/src/java/org/apache/commons/net/tftp TFTPClient.java
Log:
Removed old commented out print statements. Also applied multi-interfaced
host patch to sendFile() which I previously applied to receiveFile().
Revision Changes Path
1.5 +10 -19
jakarta-commons-sandbox/net/src/java/org/apache/commons/net/tftp/TFTPClient.java
Index: TFTPClient.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/tftp/TFTPClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TFTPClient.java 17 Sep 2002 21:48:07 -0000 1.4
+++ TFTPClient.java 17 Sep 2002 22:02:32 -0000 1.5
@@ -192,7 +192,6 @@
{
try
{
- //System.err.println("Receiving.");
received = bufferedReceive();
break;
}
@@ -221,9 +220,8 @@
}
}
- //System.err.println("Got an answer.");
-
- // The first time we receive we get the port number.
+ // The first time we receive we get the port number and
+ // answering host address (for hosts with multiple IPs)
if (lastBlock == 0)
{
hostPort = received.getPort();
@@ -242,8 +240,6 @@
received.getPort() == hostPort)
{
- //System.err.println("Got this far.");
-
switch (received.getType())
{
case TFTPPacket.ERROR:
@@ -257,8 +253,6 @@
lastBlock = data.getBlockNumber();
- //System.err.println("Data: Got Block: " + lastBlock +"
Expected: " + block);
-
if (lastBlock == block)
{
try
@@ -309,12 +303,9 @@
//break;
}
- //System.err.println("Setting acknowledgement: " + lastBlock);
-
ack.setBlockNumber(lastBlock);
sent = ack;
bytesRead += dataLength;
- //System.err.println("bytesRead: " + bytesRead);
} // First data packet less than 512 bytes signals end of stream.
while (dataLength == TFTPPacket.SEGMENT_SIZE);
@@ -441,7 +432,6 @@
{
try
{
- //System.err.println("Receiving.");
received = bufferedReceive();
break;
}
@@ -470,13 +460,18 @@
}
}
- //System.err.println("Got an answer.");
-
- // The first time we receive we get the port number.
+ // The first time we receive we get the port number and
+ // answering host address (for hosts with multiple IPs)
if (lastBlock == 0)
{
hostPort = received.getPort();
data.setPort(hostPort);
+ if(!host.equals(received.getAddress()))
+ {
+ host = received.getAddress();
+ data.setAddress(host);
+ sent.setAddress(host);
+ }
}
// Comply with RFC 783 indication that an error acknowledgement
@@ -485,8 +480,6 @@
received.getPort() == hostPort)
{
- //System.err.println("Got this far.");
-
switch (received.getType())
{
case TFTPPacket.ERROR:
@@ -498,8 +491,6 @@
ack = (TFTPAckPacket)received;
lastBlock = ack.getBlockNumber();
-
- //System.err.println("Ack: Got Block: " + lastBlock +"
Expected: " + block);
if (lastBlock == block)
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>