diff options
| author | bernard.xiong <[email protected]> | 2009-12-03 13:12:23 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2009-12-03 13:12:23 +0000 |
| commit | 84bf060294b0077b147d5dca4599d67127e7742f (patch) | |
| tree | 085dd7162b389d975376e2e758219edf0d53c367 /net | |
| parent | 18bb6d8a39a462373b69fd40b96db4ec3a159584 (diff) | |
tftp put is ok.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@191 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'net')
| -rw-r--r-- | net/apps/tftp.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/net/apps/tftp.c b/net/apps/tftp.c index 6094382d22..7e5b1f90d9 100644 --- a/net/apps/tftp.c +++ b/net/apps/tftp.c @@ -166,9 +166,13 @@ void tftp_put(const char* host, const char* dir, const char* filename) tftp_buffer[3] = block_number & 0xff;
lwip_sendto(sock_fd, tftp_buffer, length + 4, 0,
- (struct sockaddr *)&tftp_addr, fromlen);
+ (struct sockaddr *)&from_addr, fromlen);
+ }
+ else
+ {
+ rt_kprintf("done\n");
+ break; /* no data yet */
}
- else break; /* no data yet */
/* receive ack */
length = lwip_recvfrom(sock_fd, tftp_buffer, sizeof(tftp_buffer), 0,
@@ -177,10 +181,11 @@ void tftp_put(const char* host, const char* dir, const char* filename) {
if ((tftp_buffer[0] == 0 &&
tftp_buffer[1] == TFTP_ACK &&
- tftp_buffer[3] == (block_number >> 8) & 0xff) &&
- tftp_buffer[2] == (block_number & 0xff))
+ tftp_buffer[2] == (block_number >> 8) & 0xff) &&
+ tftp_buffer[3] == (block_number & 0xff))
{
block_number ++;
+ rt_kprintf("#");
}
else
{
@@ -188,6 +193,11 @@ void tftp_put(const char* host, const char* dir, const char* filename) break;
}
}
+ else if (length == 0)
+ {
+ rt_kprintf("server timeout\n");
+ break;
+ }
}
close(fd);
|
