update ftpclient

This commit is contained in:
Ambrumf 2023-10-12 10:17:57 +08:00
parent 9582205bd8
commit 4d938bc81d
1 changed files with 1 additions and 15 deletions

View File

@ -23,6 +23,7 @@ http://license.coscl.org.cn/MulanPSL2
#include <transform.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys.h>
#include "lwip/sockets.h"
#include "test_ftpclient.h"
@ -214,11 +215,9 @@ int Download(char *name)
return -1;
}
closesocket(data_fd);
printf("creating file %s ....\r\n",name);
int file=open(name,O_RDWR | O_CREAT);
if(file > 0){
printf("%d\n",file);
ret = write(file,buf,strlen(buf));
printf("%d\n",ret);
if(ret < 0 ){
@ -235,22 +234,9 @@ int Download(char *name)
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()
{
CreateTestFile();
lwip_config_tcp(0, tcp_demo_ipaddr, tcp_demo_netmask, tcp_demo_gwaddr);
cmd_fd = socket(AF_INET, SOCK_STREAM, 0);