ArxOne / FTP

Simple FTP client
MIT License
37 stars 15 forks source link

Asynchronous API #49

Open neptunao opened 5 years ago

neptunao commented 5 years ago

It would be really nice to have asynchronous API since this library provide an interface for network I/O. The best possible solution will be to target .NET >= 4.5 and use async/await pattern, but if it's not possible we can at least implement it using older patterns, as IAsyncResult.

picrap commented 5 years ago

Sure! However I don't want to drop .NET 4.0 compatibility for now and I still want the synchronous API side-by-side. So maybe we could provide another assembly, specific to .NET 4.5 and .NET standard for async, based on a common IAsyncResult, as you suggested?

picrap commented 5 years ago

Digging further, we can probably add *Async methods with the current implementation so stay in .NET 4.0.

neptunao commented 5 years ago

We can also include Async Targeting Pack, though I don't think that's a good idea. Probably the best way is to have IAsyncResult based approach in the main assembly, and have extension assembly for .NET >= 4.5 with Tasks from IAsyncResult.

picrap commented 5 years ago

There is probably no need to have a .NET 4.5 special assembly. If alternative methods return a Task or Task<>, it can be processed from a .NET 4.5 using async/await.