void listener_Accepted(object sender, SocketAcceptedEventArgs e) { if (InvokeRequired) { Invoke(new SocketAcceptedHandler(listener_Accepted), sender, e); return; } //Stop the listener listener.Stop(); //listener1.Stop(); //Create the transfer client based on our newly connected socket. transferClient = new TransferClient(e.Accepted); //Set our output folder. transferClient.OutputFolder = outputFolder; //Register the events. registerEvents(); //Run the client transferClient.Run(); //Start the progress timer tmrOverallProg.Start(); //And set the new connection state. setConnectionStatus(transferClient.EndPoint.Address.ToString()); }
private void SocketListener_SocketReceived(object sender, SocketAcceptedEventArgs e) { if (this.SocketReceived != null) { this.SocketReceived(this, e); } }
private void ClientConnected(object _, SocketAcceptedEventArgs eventArgs) { try { var clientSession = ServiceProvider.GetRequiredService <IClient>(); clientSession.Setup(eventArgs.Socket); clientSession.OnDisconnected += ClientDisconnected; clientSession.OnDataReceived += ClientDataReceived; // must add the socket to client store before calling StartReceiveProcess // otherwise we might receive messages before having access to client in client store _clientStore.Add(clientSession); clientSession.StartReceiveProcess(); clientSession.StartSendProcess(); _logger.LogInformation($"Client: {clientSession.Id} connected"); } catch (ObjectDisposedException) { // ignore ObjectDisposedException } }
private void Listener_Accepted(object sender, SocketAcceptedEventArgs e) { listeners.Stop(); transferClient = new TransferClient(e.Accepted); transferClient.OutputFolder = outputfolder; RegisterEvents(); transferClient.Run(); tmrOverallprog.Start(); setConnetionStaus(transferClient.EndPoint.Address.ToString()); }
private void OnAcceptSuccess(Socket socket) { _logger.LogInformation($"Accepted new socket connection from {socket.RemoteEndPoint}"); var tcpSocket = new TcpSocket(socket); var socketAcceptedEventArgs = new SocketAcceptedEventArgs { Socket = tcpSocket }; OnSocketAccepted?.Invoke(this, socketAcceptedEventArgs); }
private void Listener_Accepted(object sender, SocketAcceptedEventArgs e) { listener.Stop(); transferClient = new TransferClient(e.Accepted); transferClient.OutputFolder = outputFolder; registerEvents(); transferClient.Run(); timerOverallProgress.Start(); ConnectionStatus = transferClient.EndPoint.Address.ToString(); sendFileCommand.RaiseCanExecuteChanged(); }
private void Listener_Accepted(object sender, SocketAcceptedEventArgs e) { if (!this.Dispatcher.CheckAccess()) { this.Dispatcher.Invoke(new SocketAcceptedHandler(this.Listener_Accepted), sender, e); return; } this.fileListener.Stop(); this.fileClient = new TransferClient(e.Accepted); this.fileClient.OutputFolder = this.outputFolder; this.RegisterEvents(); this.fileClient.Run(); }
void connectionHandler_SocketAccepted(object sender, SocketAcceptedEventArgs e) { Logger.Debug("Proxy: Connection accepted"); HttpParser parser = ConnectionAccepted(e.Socket); if (parser != null) { e.Handled = true; parser.Closed += parser_Closed; parser.Start(); lock (parserSync) parsers.Add(parser); } }
private void listener_SocketAccepted(object sender, SocketAcceptedEventArgs e) { T connection = OnSocketAccepted(e.Socket); if (connection != null) { e.Handled = true; connection.Closed += connection_Closed; lock (connectionSync) { connections.Add(connection); connection.Start(); } } }
private void listener_Accepted(object sender, SocketAcceptedEventArgs e) { if (InvokeRequired) { Invoke(new SocketAcceptedHandler(listener_Accepted), sender, e); return; } listener.Stop(); transferClient = new TransferClient(e.Accepted); transferClient.OutputFolder = outputFolder; registerEvents(); transferClient.Run(); tmrOverallProg.Start(); setConnectionStatus(transferClient.EndPoint.Address.ToString()); }
private void Listener_Accepted(object sender, SocketAcceptedEventArgs e) { }
private void RequestHandlerEngine_SocketReceived(object sender, SocketAcceptedEventArgs e) { //if (e.SocketAccepted != null && e.SocketAccepted.RemoteEndPoint != null) // Logger.LogInfo(string.Format("收到来自{0}的连接请求", e.SocketAccepted.RemoteEndPoint.ToString())); }