FTP Error 125 Data already open

A

Alan Gillott

Can anyone offer a words of one syllable explanation of this error? I've
scoured all the samples I can find, and my code appears to reflect everyone
elses and no samples seem to handle errors. Here's the code:

Private Function DoFTPRequest(ByVal url As String, ByVal method As String,
ByVal usebinary As Boolean, ByRef data As stream) As FtpStatusCode
'Imports System.Net
'Imports System.IO
Dim result As FtpStatusCode
Dim req As FtpWebRequest
Dim resp As FtpWebResponse
Dim creds As New NetworkCredential("anonymous", "(e-mail address removed)")
creds.UserName = "anonymous" 'For testing
creds.Password = "(e-mail address removed)"
req = DirectCast(WebRequest.Create(url), FtpWebRequest)
With req
''''''.Credentials = creds
.UseBinary = usebinary
.UsePassive = True
.KeepAlive = True
'.Method = method
.Method = "LIST"
resp = .GetResponse()
data = resp.GetResponseStream
result = resp.StatusCode
End With
Return result
End Function

It seems to give me the samer error with or without credentials. I'm
inclined to suspect an infrastructure or installation issue.
A
 
K

kimiraikkonen

Can anyone offer a words of one syllable explanation of this error? I've
scoured all the samples I can find, and my code appears to reflect everyone
elses and no samples seem to handle errors. Here's the code:

Private Function DoFTPRequest(ByVal url As String, ByVal method As String,
ByVal usebinary As Boolean, ByRef data As stream) As FtpStatusCode
        'Imports System.Net
        'Imports System.IO
        Dim result As FtpStatusCode
        Dim req As FtpWebRequest
        Dim resp As FtpWebResponse
        Dim creds As New NetworkCredential("anonymous", "(e-mail address removed)")
        creds.UserName = "anonymous"    'For testing
        creds.Password = "(e-mail address removed)"
        req = DirectCast(WebRequest.Create(url), FtpWebRequest)
        With req
            ''''''.Credentials = creds
            .UseBinary = usebinary
            .UsePassive = True
            .KeepAlive = True
            '.Method = method
            .Method = "LIST"
            resp = .GetResponse()
            data = resp.GetResponseStream
            result = resp.StatusCode
        End With
        Return result
    End Function

It seems to give me the samer error with or without credentials. I'm
inclined to suspect an infrastructure or installation issue.
A

At which line you get which error? Meanwhile, put your "imports"
statement at the top of your code page, not inside your sub. Also
remove " ' " (comment specifier) in front of "imports" if you really
want to import the namespace (that wouldn't related to your error,
just extra info).
 
A

Alan Gillott

The error is returned in Resp.statusCode
As a matter of course, I alwas document the Import needed by any routine
that uses odd (as in peculiar) imports that might find its way into other
applications: that way I don't waste time futsing around with the object
explorer trying to guess what Import I might need.
A

Can anyone offer a words of one syllable explanation of this error? I've
scoured all the samples I can find, and my code appears to reflect
everyone
elses and no samples seem to handle errors. Here's the code:

Private Function DoFTPRequest(ByVal url As String, ByVal method As String,
ByVal usebinary As Boolean, ByRef data As stream) As FtpStatusCode
'Imports System.Net
'Imports System.IO
Dim result As FtpStatusCode
Dim req As FtpWebRequest
Dim resp As FtpWebResponse
Dim creds As New NetworkCredential("anonymous", "(e-mail address removed)")
creds.UserName = "anonymous" 'For testing
creds.Password = "(e-mail address removed)"
req = DirectCast(WebRequest.Create(url), FtpWebRequest)
With req
''''''.Credentials = creds
.UseBinary = usebinary
.UsePassive = True
.KeepAlive = True
'.Method = method
.Method = "LIST"
resp = .GetResponse()
data = resp.GetResponseStream
result = resp.StatusCode
End With
Return result
End Function

It seems to give me the samer error with or without credentials. I'm
inclined to suspect an infrastructure or installation issue.
A

At which line you get which error? Meanwhile, put your "imports"
statement at the top of your code page, not inside your sub. Also
remove " ' " (comment specifier) in front of "imports" if you really
want to import the namespace (that wouldn't related to your error,
just extra info).
 
K

kimiraikkonen

The error is returned in Resp.statusCode
As a matter of course, I alwas document the Import needed by any routine
that uses odd (as in peculiar) imports that might find its way into other
applications: that way I don't waste time futsing around with the object
explorer trying to guess what Import I might need.
A






At which line you get which error? Meanwhile, put your "imports"
statement at the top of your code page, not inside your sub. Also
remove " ' " (comment specifier) in front of "imports" if you really
want to import the namespace (that wouldn't related to your error,
just extra info).- Hide quoted text -

- Show quoted text -

Could you solve if you remove this codeline? I guess the code might be
informational without being sure, i guess that means the connection is
instantinated and ready and starting transferring.

Look at this:
"100 Code Series: The requested action is being initiated, expect
another reply before proceeding with a new command."

http://www.coffeecup.com/direct-ftp/help/ftp-return-and-error-codes.398.html
 
A

Alan Gillott

Thank you for taking the time to look at this with me. I kinda guessed that
but was purplexed as this is meant to be a synchronous transfer, not an
asynchronous one, so I would not expect it to return until the transfer was
complete. this is code copied from several samples and all of them assume
that the next executed instruction won't ocur until after the transfer is
complete. Do I have to recode as asynchronous? That would be tiresome.

Do I loop round waiting for something other than 125? Any one who knows
please respond.

A

The error is returned in Resp.statusCode
As a matter of course, I alwas document the Import needed by any routine
that uses odd (as in peculiar) imports that might find its way into other
applications: that way I don't waste time futsing around with the object
explorer trying to guess what Import I might need.
A






At which line you get which error? Meanwhile, put your "imports"
statement at the top of your code page, not inside your sub. Also
remove " ' " (comment specifier) in front of "imports" if you really
want to import the namespace (that wouldn't related to your error,
just extra info).- Hide quoted text -

- Show quoted text -

Could you solve if you remove this codeline? I guess the code might be
informational without being sure, i guess that means the connection is
instantinated and ready and starting transferring.

Look at this:
"100 Code Series: The requested action is being initiated, expect
another reply before proceeding with a new command."

http://www.coffeecup.com/direct-ftp/help/ftp-return-and-error-codes.398.html
 
K

kimiraikkonen

Thank you for taking the time to look at this with me. I kinda guessed that
but was purplexed as this is meant to be a synchronous transfer, not an
asynchronous one, so I would not expect it to return until the transfer was
complete. this is code copied from several samples and all of them assume
that the next executed instruction won't ocur until after the transfer is
complete. Do I have to recode as asynchronous? That would be tiresome.

Do I loop round waiting for something other than 125? Any one who knows
please respond.

A








Could you solve if you remove this codeline? I guess the code might be
informational without being sure, i guess that means the connection is
instantinated and ready and starting transferring.

Look at this:
"100 Code Series: The requested action is being initiated, expect
another reply before proceeding with a new command."

http://www.coffeecup.com/direct-ftp/help/ftp-return-and-error-codes.3...- Hide quoted text -

- Show quoted text -

I guess you could get the code working async. Could you try to use
Background Worker control and put the code inside background control's
doWork event and call worker with bg worker's RunWorkerAsync function.
Sorry, if this wouldn't help.
 
A

Alan Gillott

I suspect that someting fundamental is askew. The site only has 10
directories on it so the download should be almost instantanious. I am
hoping someone long in the FTP tooth might see this and respond!
a

Thank you for taking the time to look at this with me. I kinda guessed
that
but was purplexed as this is meant to be a synchronous transfer, not an
asynchronous one, so I would not expect it to return until the transfer
was
complete. this is code copied from several samples and all of them assume
that the next executed instruction won't ocur until after the transfer is
complete. Do I have to recode as asynchronous? That would be tiresome.

Do I loop round waiting for something other than 125? Any one who knows
please respond.

A








Could you solve if you remove this codeline? I guess the code might be
informational without being sure, i guess that means the connection is
instantinated and ready and starting transferring.

Look at this:
"100 Code Series: The requested action is being initiated, expect
another reply before proceeding with a new command."

http://www.coffeecup.com/direct-ftp/help/ftp-return-and-error-codes.3...-
Hide quoted text -

- Show quoted text -

I guess you could get the code working async. Could you try to use
Background Worker control and put the code inside background control's
doWork event and call worker with bg worker's RunWorkerAsync function.
Sorry, if this wouldn't help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top