当前位置: 首页 > 知识库问答 >
问题:

以太网屏蔽arduino上的FTP客户端

赫连永怡
2023-03-14

我想做一个项目,其中数据保存在SD卡上,然后使用以太网屏蔽,使用ftp客户端arduino将这些数据发送到ftp服务器。服务器我有一个免费的主机。

以下是ftptest中的数据服务器:

 

    Status: Resolving address of cba.pl
    Status: Connecting to 95.211.144.68
    Warning: The entered address does not resolve to an IPv6 address.
    Status: Connected, waiting for welcome message...
    Reply: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
    Reply: 220-You are user number 57 of 200 allowed.
    Reply: 220-Local time is now 16:30. Server port: 21.
    Reply: 220-This is a private system - No anonymous login
    Reply: 220-IPv6 connections are also welcome on this server.
    Reply: 220 You will be disconnected after 5 minutes of inactivity.
    Command: CLNT https://ftptest.net on behalf of 2a02:a311:c020:3200:c10d:18e1:36a5:8e2
    Reply: 530 You aren't logged in
    Command: AUTH TLS
    Reply: 234 AUTH TLS OK.
    Status: Performing TLS handshake...
    Status: TLS handshake successful, verifying certificate...
    Status: Received 2 certificates from server.
    Status: cert[0]: subject='CN=www.cba.pl' issuer='C=US,O=Let\27s Encrypt,CN=Let\27s Encrypt Authority X3'
    Status: cert[1]: subject='C=US,O=Let\27s Encrypt,CN=Let\27s Encrypt Authority X3' issuer='O=Digital Signature Trust Co.,CN=DST Root CA X3'
    Command: USER wsalkowski
    Reply: 331 User wsalkowski OK. Password required
    Command: PASS ********
    Reply: 230-Your bandwidth usage is restricted
    Reply: 230-OK. Current restricted directory is /
    Reply: 230 Max allowed filesize is 10485760 bytes
    Command: SYST
    Reply: 215 UNIX Type: L8
    Command: FEAT
    Reply: 211-Extensions supported:
    Reply: EPRT
    Reply: IDLE
    Reply: MDTM
    Reply: SIZE
    Reply: MFMT
    Reply: REST STREAM
    Reply: MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
    Reply: MLSD
    Reply: AUTH TLS
    Reply: PBSZ
    Reply: PROT
    Reply: UTF8
    Reply: TVFS
    Reply: ESTA
    Reply: PASV
    Reply: EPSV
    Reply: SPSV
    Reply: ESTP
    Reply: 211 End.
    Command: PBSZ 0
    Reply: 200 PBSZ=0
    Command: PROT P
    Reply: 200 Data protecthtml" target="_blank">ion level set to "private"
    Command: PWD
    Reply: 257 "/" is your current location
    Status: Current path is /
    Command: TYPE I
    Reply: 200 TYPE is now 8-bit binary
    Command: PASV
    Reply: 227 Entering Passive Mode (95,211,144,68,218,36)
    Command: MLSD
    Status: Data connection established, performing TLS handshake...
    Reply: 150 Accepted data connection
    Status: TLS handshake successful, verifying certificate...
    Status: Received 2 certificates from server.
    Status: cert[0]: subject='CN=www.cba.pl' issuer='C=US,O=Let\27s Encrypt,CN=Let\27s Encrypt Authority X3'
    Status: cert[1]: subject='C=US,O=Let\27s Encrypt,CN=Let\27s Encrypt Authority X3' issuer='O=Digital Signature Trust Co.,CN=DST Root CA X3'
    Status: TLS session of transfer connection has been resumed.
    Listing: type=cdir;sizd=4096;modify=20160501192730;UNIX.mode=0755;UNIX.uid=0;UNIX.gid=0;unique=803g16f353ca; .
    Listing: type=pdir;sizd=4096;modify=20160501192730;UNIX.mode=0755;UNIX.uid=0;UNIX.gid=0;unique=803g16f353ca; ..
    Listing: type=dir;sizd=4096;modify=20161031125022;UNIX.mode=0700;UNIX.uid=1098695;UNIX.gid=33;unique=803g2259f68; wsalkowski.cba.pl
    Reply: 226-Options: -a -l
    Reply: 226 3 matches total
    Status: Success
    Results
    Your server is working and assorted routers/firewalls have been correctly configured for explicit FTP over TLS as performed by this test. However there have been warnings about compatibility issues, not all users will be able to use your server.
    For maximum compatibility, consider resolving these warnings. 

这里的结果从串行监视器arduino ide


    Ready. Press f or r
    kkksdsSD opened
    Command connected
    220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
    220-You are user number 52 of 200 allowed.
    220-Local time is now 15:32. Server port: 21.
    220-This is a private system - No anonymous login
    220-IPv6 connections are also welcome on this server.
    220 You will be disconnected after 5 minutes of inactivity.
    331 User wsalkowski OK. Password required
    230-Your bandwidth usage is restricted
    230-OK. Current restricted directory is /
    230 Max allowed filesize is 10485760 bytes
    215 UNIX Type: L8
    227 Entering Passive Mode (95,211,144,65,208,115)
    Data port: 53363
    Data connected
    553 Can't open that file: No such file or directory
    221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
    221 Logout.
    Command disconnected
    SD closed
    FTP FAIL
    SD opened
    Command connected
    220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
    220-You are user number 53 of 200 allowed.
    220-Local time is now 15:32. Server port: 21.
    220-This is a private system - No anonymous login
    220-IPv6 connections are also welcome on this server.
    220 You will be disconnected after 5 minutes of inactivity.
    331 User wsalkowski OK. Password required
    230-Your bandwidth usage is restricted
    230-OK. Current restricted directory is /
    230 Max allowed filesize is 10485760 bytes
    215 UNIX Type: L8
    227 Entering Passive Mode (95,211,144,65,208,248)
    Data port: 53496
    Data connected
    553 Can't open that file: No such file or directory
    221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
    221 Logout.
    Command disconnected
    SD closed
    FTP FAIL

这里代码arduino(我从http://playground.arduino.cc/Code/FTP的代码)

/*


     FTP passive client for IDE v1.0.1 and w5100/w5200
       Posted October 2012 by SurferTim
       Modified 6 June 2015 by SurferTim
    */

    #include 
    #include 
    #include 
    // comment out next line to write to SD from FTP server
    #define FTPWRITE

    // this must be unique
    byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x59, 0x67 } ;  

    // change to your network settings
    IPAddress ip( 192, 168, 0, 25 );    
    IPAddress gateway( 192, 168, 0, 1 );
    IPAddress subnet( 255, 255, 255, 0 );

    // change to your server
    IPAddress server( 95, 211, 144, 65);

    EthernetClient client;
    EthernetClient dclient;

    char outBuf[128];
    char outCount;

    // change fileName to your file (8.3 format!)
    char fileName[13] = "POMIARY.txt";

    void setup()
    {
      Serial.begin(9600);

      digitalWrite(10,HIGH);

      if(SD.begin(4) == 0)
      {
        Serial.println(F("SD init fail"));          
      }

      Ethernet.begin(mac, ip, gateway, gateway, subnet); 
      digitalWrite(10,HIGH);
      delay(2000);
      Serial.println(F("Ready. Press f or r"));
    }

    void loop()
    {
      byte inChar;

      inChar = Serial.read();

      if(inChar == 'f')
      {
        if(doFTP()) Serial.println(F("FTP OK"));
        else Serial.println(F("FTP FAIL"));
      }

      if(inChar == 'r')
      {
        readSD();    
      }

    }

    File fh;

    byte doFTP()
    {
    #ifdef FTPWRITE
      fh = SD.open(fileName,FILE_READ);
    #else
      SD.remove(fileName);
      fh = SD.open(fileName,FILE_WRITE);
    #endif

      if(!fh)
      {
        Serial.println(F("SD open fail"));
        return 0;    
      }

    #ifndef FTPWRITE  
      if(!fh.seek(0))
      {
        Serial.println(F("Rewind fail"));
        fh.close();
        return 0;    
      }
    #endif

      Serial.println(F("SD opened"));

      if (client.connect(server,21)) {
        Serial.println(F("Command connected"));
      } 
      else {
        fh.close();
        Serial.println(F("Command connection failed"));
        return 0;
      }

      if(!eRcv()) return 0;

    // Change to your user and password  
      client.write("USER wsalkowski\r\n");

      if(!eRcv()) return 0;

      client.write("PASS pass\r\n");

      if(!eRcv()) return 0;

      client.write("SYST\r\n");

      if(!eRcv()) return 0;

      client.write("PASV\r\n");

      if(!eRcv()) return 0;


      char *tStr = strtok(outBuf,"(,");
      int array_pasv[6];
      for ( int i = 0; i  63)
        {
          dclient.write(clientBuf,64);
          clientCount = 0;
        }
      }

      if(clientCount > 0) dclient.write(clientBuf,clientCount);

    #else
      while(dclient.connected())
      {
        while(dclient.available())
        {
          char c = dclient.read();
          fh.write(c);      
          Serial.write(c); 
        }
      }
    #endif

      dclient.stop();
      Serial.println(F("Data disconnected"));

      if(!eRcv()) return 0;

      client.println(F("QUIT"));

      if(!eRcv()) return 0;

      client.stop();
      Serial.println(F("Command disconnected"));

      fh.close();
      Serial.println(F("SD closed"));
      return 1;
    }

    byte eRcv()
    {
      byte respCode;
      byte thisByte;

      while(!client.available()) delay(1);

      respCode = client.peek();

      outCount = 0;

      while(client.available())
      {  
        thisByte = client.read();    
        Serial.write(thisByte);

        if(outCount = '4')
      {
        efail();
        return 0;  
      }

      return 1;
    }


    void efail()
    {
      byte thisByte = 0;

      client.println(F("QUIT"));

      while(!client.available()) delay(1);

      while(client.available())
      {  
        thisByte = client.read();    
        Serial.write(thisByte);
      }

      client.stop();
      Serial.println(F("Command disconnected"));
      fh.close();
      Serial.println(F("SD closed"));
    }

    void readSD()
    {
      fh = SD.open(fileName,FILE_READ);

      if(!fh)
      {
        Serial.println(F("SD open fail"));
        return;    
      }

      while(fh.available())
      {
        Serial.write(fh.read());
      }

      fh.close();
    }

如果有人告诉我什么可以去,我做错了什么?

我可以使用filezilla抛出文件,但只能将文件抛出到文件夹wsalkowski。中国篮球协会pl

问题是否缺乏访问路径/wsalkowski.cba.pl从ftp客户端arduino?也就是说,带有默认sd卡的文件被抛到根文件夹/,它没有权限chmod?

请帮帮我,对不起我的英语

共有1个答案

东门彬
2023-03-14

让我们尝试更改您的FTP服务器。若您登录到FTP,服务器可能会出现问题。

 类似资料:
  • 使用指南 - 数据报告 - 流量分析 - 客户版屏蔽异常IP与访客 做推广投放的客户会比较了解,网站经常会有一些异常的IP/访客点击网站的广告,如同行、水军、推销、软件攻击等,给网站带来无效的花费。对于这种情况,您可以使用百度统计的屏蔽功能,对这些异常IP/访客进行广告屏蔽,使您网站的搜索广告不对这些IP/访客展示,进而节省无效消费。 百度统计的屏蔽功能仅支持推广账号,屏蔽的入口在实时访客报告中。

  • 我正在测试WiFi UDP发送和接收字符串示例Arduino代码与Arduino Wifi屏蔽(最新固件更新2013年3月),我得到的行为我无法解释。 Arduino在其本地任意端口上从路由器上的另一台计算机接收UDP数据包。它通过将它自己的UDP数据包发送回远程IP:远程端口来向客户端确认它已经收到数据包。 netcat将发送UDP数据包,Arduino接收,但是netcat没有收到Arduin

  • There are many Ethereum clients to choose from. We recommend different clients depending on whether you are developing or deploying. 开发过程中 Ganache We recommend Ganache, a personal blockchain for Ether

  • FileZilla是一个开源的FTP客户端,可以在Linux和Windows等多种平台上使用。 此客户端还支持通过SFTP和FTPS的安全连接进行FTP。 您可以使用此软件在网络服务器中上传和管理文件。 当您希望上传您的网站时,文件数量或文件大小都非常大。 然后你可以使用FTP上传,因为通过cPanel文件管理器上传一个非常大的文件会导致上传错误。 大多数cPanel帐户都附带系统FTP帐户,您可

  • 使用指南 - 账户管理 - 屏蔽管理 - 如何屏蔽IP和访客 如果您希望自己的搜索推广广告不展现给指定的IP或访客,您可以在“报告”->”流量分析”->“实时访客”报告中对这些IP和访客进行屏蔽。 鼠标悬停在如图位置,将会有提示您可以屏蔽该IP或屏蔽该访客标识码。如果未找到访客IP或访客标识码指标,可以到上方的自定义指标中进行设置。 注意: 1、屏蔽功能只针对搜索推广带来的访客,如果非搜索推广带来

  • 很多客户使用E立方管理平台时,需要使用FTP方式完成附件或图片的传输,如何对客户端进行FTP检测呢? 下边介绍检测方法: 1、首先,客户端电脑的防火墙要开放 21号 端口 2、点击 E立方管理平台-->选项 这里有测试 3、FTP采用被动模式 选中和不选中,分别 检测 一下(检测完一种后,关闭窗体重新打开再测试另外一种) 看见如下提示就表示可以使用这种方式了 >