tftp put is ok.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@191 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
18bb6d8a39
commit
84bf060294
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue