From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FTP Timeout and FTP protocol question

I'm unable to open an FTP connection in LabVIEW, I can in a browser.  I drilled down and found TCP Read xTP Reply.vi  is the issue.

It's using ^[0-9][0-9][0-9] [^\r\n]*\r\n as the pattern on a match pattern.

My FTP's reply is:

220-FTP Server
220-*** Files stored here are not backed up ***
220-*** Please move any important files to  ***
220 *** alternate storage.            ***

The dash is the problem.  I'm trying to find out if the dash is actually violating the FTP protocol on replys so I can tell IT they messed up!  😛  I mean, ask them nicely to change it.  Or if the VI should be modified because there mite not always be a space.

0 Kudos
Message 1 of 14
(4,463 Views)

Hey , 

 

I'm not really sure what your question is with regards to LabVIEW. 

 

It seems you are talking about FTP protocol with references to syntax and using a hyphen? "-"?

 

In the following link, it talks about using a hyphen in the reply of FTP protocol:

https://www.w3.org/Protocols/rfc959/4_FileTransfer.html

Specifically,

"

the format for multi-line replies is that the first line
         will begin with the exact required reply code, followed
         immediately by a Hyphen, "-" (also known as Minus), followed by
         text.  The last line will begin with the same code, followed
         immediately by Space <SP>, optionally some text, and the Telnet
         end-of-line code.

            For example:
                                123-First line
                                Second line
                                  234 A line beginning with numbers
                                123 The last line"

 Let me know if this addresses the issue you were having. 

0 Kudos
Message 2 of 14
(4,414 Views)

LabVIEW won't open an FTP site that replies with multiple lines then.  The pattern anchors the 3 digit reply code to the start of the string and there is no space.

0 Kudos
Message 3 of 14
(4,408 Views)

Hey, 

To get a better idea of what you're working with. Are you using the FTP functions built into LabVIEW? 

 

FTP VIs

http://zone.ni.com/reference/en-XX/help/371361K-01/lvcomm/ftp_vis/

 

 

Also would you be able to make a snippit of your code so that I could determine what the issue is? 

Use VI Snippet to Store and Share Reusable Code Sections

http://www.ni.com/tutorial/9330/en/

0 Kudos
Message 4 of 14
(4,396 Views)

Built in FTP VI's.  It is getting stuck in the FTP open.

0 Kudos
Message 5 of 14
(4,391 Views)

I have a couple ideas about that.

Firstly, your syntax should probably look something like the following: 

post-15324-0-89154900-1369910270_thumb.j

 

Also, I suggest testing your VI with constants to make sure that your syntax is correct. Try finding a simple example that works and then building on that. 

0 Kudos
Message 6 of 14
(4,375 Views)

You have a reset from somewhere in front, but the only input that matters is the IP.  The IP is right because I'm getting a reply.  I never get out of the FTP open.  I'm pretty sure if you aim your VI at any FTP server with a multi-line response it will fail.

0 Kudos
Message 7 of 14
(4,362 Views)

How are you getting a reply back if you hang in the FTP open?

 

Have you tested this reading back a single line? Is that working exactly as expected?

 

What does a "fail" mean for multi-line responses?

 

It appears that the standard FTP protocol uses "-" (minus) when doing multi-line responses, so I'm still a bit confused on what behavior you are seeing. 

 

Spencer R | NI

0 Kudos
Message 8 of 14
(4,337 Views)

I have now also put a filezilla FTP server up locally.  I can open it in my browser. (ftp://192.168.44.53/)

My code also opens that FTP site and gets a directory list, as designed.

 

When I change the IP to point at the company FTP that responds with multiple lines it gets error 56

Open the FTP Open Session.vi

Drill down to: FTP Get Command Reply.vi -> TCP Read xTP Reply.vi (Snippet attached)

You can see a match pattern with ^[0-9][0-9][0-9] [^\r\n]*\r\n   It's looking at a shift register with the reply string.  I probed it:

220-FTP Server
220-*** Files stored here are not backed up ***
220-*** Please move any important files to  ***
220 *** alternate storage.            ***

 

As I said in the first post, that pattern will NEVER find the reply because it must be ###<SPACE> and a multi line replies ###<DASH> and it's anchored to the start of the offset 0.

Also attached a match pattern wired up to show it.

 

Download All
0 Kudos
Message 9 of 14
(4,323 Views)

Hi,

 

Is it possible to receive the multiple line response and convert it to a single line so that FTP Open will not hang?

Adam
0 Kudos
Message 10 of 14
(4,297 Views)