update ftpclient
This commit is contained in:
parent
9582205bd8
commit
4d938bc81d
|
@ -23,6 +23,7 @@ http://license.coscl.org.cn/MulanPSL2
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sys.h>
|
#include <sys.h>
|
||||||
#include "lwip/sockets.h"
|
#include "lwip/sockets.h"
|
||||||
#include "test_ftpclient.h"
|
#include "test_ftpclient.h"
|
||||||
|
@ -214,11 +215,9 @@ int Download(char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
closesocket(data_fd);
|
closesocket(data_fd);
|
||||||
|
|
||||||
printf("creating file %s ....\r\n",name);
|
printf("creating file %s ....\r\n",name);
|
||||||
int file=open(name,O_RDWR | O_CREAT);
|
int file=open(name,O_RDWR | O_CREAT);
|
||||||
if(file > 0){
|
if(file > 0){
|
||||||
printf("%d\n",file);
|
|
||||||
ret = write(file,buf,strlen(buf));
|
ret = write(file,buf,strlen(buf));
|
||||||
printf("%d\n",ret);
|
printf("%d\n",ret);
|
||||||
if(ret < 0 ){
|
if(ret < 0 ){
|
||||||
|
@ -235,22 +234,9 @@ int Download(char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateTestFile()
|
|
||||||
{
|
|
||||||
int fd = open("/test.txt",O_RDWR | O_CREAT);
|
|
||||||
if(fd>0){
|
|
||||||
printf("%d\n",fd);
|
|
||||||
char * hello="hello";
|
|
||||||
int ret = write(fd,hello,sizeof(hello));
|
|
||||||
printf("%d\n",ret);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int TestFtp()
|
int TestFtp()
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateTestFile();
|
|
||||||
|
|
||||||
lwip_config_tcp(0, tcp_demo_ipaddr, tcp_demo_netmask, tcp_demo_gwaddr);
|
lwip_config_tcp(0, tcp_demo_ipaddr, tcp_demo_netmask, tcp_demo_gwaddr);
|
||||||
|
|
||||||
cmd_fd = socket(AF_INET, SOCK_STREAM, 0);
|
cmd_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|
Loading…
Reference in New Issue