WinSCPnet Error -2146233079 Session is already opened

Advertisement

ToniJ
Guest

WinSCPnet Error -2146233079 Session is already opened

My application in VB6 uses successfully WinSCPnet.dll for connect to FTP.
With a certain FTP that has 12471 files in the root folder, this error appears when requesting the list of files.
It connect fine, but in this point:
Dim directory As winscpnet.RemoteDirectoryInfo
Set directory = mySession.ListDirectory("/")
-2146233079 Session is already opened
With other FTP, it works fine.

Any idea?

Thanks.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
37,599
Location:
Prague, Czechia

Re: WinSCPnet Error -2146233079 Session is already opened

Please post session and debug logs.

Though Session.ListDirectory never throws "Session is already opened" error.

Reply with quote

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

Hi, first of all, I apologize for the delay in responding and now I return to this topic, without leaving it.
I attach session log and debug log.
I use WinSCP 5.19.6 (.NET assembly – COM Library)

Thanks for advance.
Toni.
  • WinSCP[DebugLogPath][Usuario] (1).log (48.88 KB, Private file)
Description: debug
  • WinSCP[SessionLogPath][Usuario] (1).log (3.51 MB, Private file)
Description: Session

Reply with quote

martin
Site Admin
martin avatar

Re: WinSCPnet Error -2146233079 Session is already opened

The debug log shows that the exception is thrown because you are trying to set (again?) Session.SessionLogPath after calling Session.Open.

Also your session and debug logs strangely do not match each other.

Reply with quote

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

Ok, I will check.
I will tell you something. Thanks a lot!

Reply with quote

Advertisement

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

The cause of the [Session is already opened] error was because after mySession.Open, I reassigned mySession.SessionLogPath and mySession.DebugLogPath again. This was my error when activating debugging and it did not let us see the following error, that is when we try to connect from the Windows Service, it hangs (similar to the another post to SFTP).

I have attached updated logs with a level of detail 2.

I think we are close to solving it. ;)

Thanks a lot Martin !!!
  • From Service (It Hangs, too).zip (3.96 KB, Private file)
  • From Console (It works, and we can ListDirectory).zip (138.32 KB, Private file)

Reply with quote

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

Martin, I need your help to solve it.

In this case, I'm executing this code:
Set mySession = New winscpnet.Session
Set mySessionOptions = New winscpnet.SessionOptions
Set myTransferOptions = New winscpnet.TransferOptions
mySession.SessionLogPath = "C:\Log\WinSCP[SessionLogPath][Usuario].log"
mySession.DebugLogLevel = -1
mySession.DebugLogPath = "C:\Log\WinSCP[DebugLogPath][Usuario].log"
mySessionOptions.protocol = Protocol_Ftp
mySessionOptions.FtpMode = winscpnet.FtpMode_Passive
myTransferOptions.TransferMode = winscpnet.TransferMode.TransferMode_Binary
With mySessionOptions
    .HostName = "184.107.41.132"
    .UserName = "fotos@esp01.aal-erp.com"
    .PassWord = "xxxx"
    .PortNumber = 21
End With
mySession.Open mySessionOptions
Does the log that I have sent you give you any clue as to what is happening?

Reply with quote

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

Wait Martin, I have found a possible cause on my part, related to the open files to debug the main program.

It seems that after calling the open of the winscpnet.dll, it affects the open files of my main program, since they will not be left with the same state.
If I disable my log file, everything works fine from the Windows service.

Reply with quote

Advertisement

ToniJ
Guest

Re: WinSCPnet Error -2146233079 Session is already opened

Confirmed Martin, if I close my application's log file before calling your Open method and then open the log file again, everything works fine.
For your information, I have this log file open with the LOCK APPEND property, in case it helps you in the future.
Thank you very much for your help Martin, it has been very helpful.

Reply with quote

Advertisement

You can post new topics in this forum