Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

nathans wrote:

This statement in documentation makes me think I may be doing something wrong:

ref - https://winscp.net/eng/docs/library_session
"The class is locked against concurrent accesses from multiple threads. Though you can use several instances of the class in parallel, even from different threads."

So, I thought that I may be hitting some contention there. I will try to reproduce in small project.

I'd appreciate, if you suggest better wording (obviously, I'm not a native English speaker).
nathans

Thank you very much for the reply.

This statement in documentation makes me think I may be doing something wrong:

ref - https://winscp.net/eng/docs/library_session
"The class is locked against concurrent accesses from multiple threads. Though you can use several instances of the class in parallel, even from different threads."


So, I thought that I may be hitting some contention there. I will try to reproduce in small project.

Thanks again
martin

Re: Parallel sessions to different hosts

The WinSCP .NET assembly interface is synchronous. So you need to have separate threads for every session, if you do not want them to blocked each other.
Also there's no problem having multiple Session instances running in parallel (in different threads).
nathans

Parallel sessions to different hosts

Hello,
What is the correct way to initiate multiple sessions each connecting to a different host? I am running some tests now with an application that starts 4 threads, each one creating a new instance of SessionOptions & WinSCP.Session(), and then calling PutFiles to send files to 4 different servers. It seems in some cases they run in parallel, but in other cases some threads will hang.

Will creating a new Session in each thread allow parallel calls to the underlying winscp.exe ?
Is this the safest/best performing strategy?

Thanks for any advice