-
-
Notifications
You must be signed in to change notification settings - Fork 178
Open
Description
Hi there
I use this server in an asp.net core webai where I just start it when I need to obtain a specific directory.
public Task StartServerForBasedir(string baseDir,
CancellationToken cancellationToken = default)
{
var ioc = new ServiceCollection();
ioc.Configure<DotNetFileSystemOptions>(options => options.RootPath = baseDir);
ioc.AddFtpServer(server => server.UseDotNetFileSystem().UseSingleRoot())
.AddSingleton<IMembershipProvider, BuddyFtpProvider>();
ioc.Configure<FtpServerOptions>(options => options.Port = ClassKey.Ports.FTP);
serviceProvider = ioc.BuildServiceProvider();
ftpService = serviceProvider.GetRequiredService<IFtpServerHost>();
return ftpService.StartAsync(cancellationToken);
}
public async Task StopServer(CancellationToken cancellationToken = default)
{
if (ftpService is null)
return;
await ftpService.StopAsync(cancellationToken);
ftpService = null;
serviceProvider?.DisposeAsync();
}Sometimes when I call StopAsync the server refuses to stop.
System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at FubarDev.FtpServer.MultiBindingTcpListener.StartListening(IEnumerable`1 addresses, Int32 port)
at FubarDev.FtpServer.MultiBindingTcpListener.StartAsync()
at FubarDev.FtpServer.Networking.FtpServerListenerService.ExecuteAsync(CancellationToken cancellationToken)
at FubarDev.FtpServer.Networking.PausableFtpService.RunAsync(IProgress`1 statusProgress)
at System.Threading.Channels.AsyncOperation`1.GetResult(Int16 token)
at FubarDev.FtpServer.FtpServer.ReadClientsAsync(ChannelReader`1 tcpClientReader, CancellationToken cancellationToken)
at FubarDev.FtpServer.FtpServer.StopAsync(CancellationToken cancellationToken)
at FubarDev.FtpServer.FtpServerHost.StopAsync(CancellationToken cancellationToken)
Frequent calls with delay dont work either :/
Any idea what the hell is wrong up there ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels