bool ISocket.StartListening(SocketConnectionAccepted callback) { IPAddress any = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(any, Netplay.ListenPort); } try { this._listener.Start(); } catch (Exception) { return false; } ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); return true; }
bool ISocket.StartListening(SocketConnectionAccepted callback) { IPAddress address = IPAddress.Any; if (Program.LaunchParameters.TryGetValue("-ip", out string value) && !IPAddress.TryParse(value, out address)) { address = IPAddress.Any; } _isListening = true; _listenerCallback = callback; if (_listener == null) { _listener = new TcpListener(address, Netplay.ListenPort); } try { _listener.Start(); } catch (Exception) { return(false); } Thread thread = new Thread(ListenLoop); thread.IsBackground = true; thread.Name = "TCP Listen Thread"; thread.Start(); return(true); }
bool Terraria.Net.Sockets.ISocket.StartListening(SocketConnectionAccepted callback) { bool flag; this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(IPAddress.Any, Netplay.ListenPort); } try { this._listener.Start(); Thread t = new Thread(ListenLoop); t.IsBackground = true; t.Name = "Listen Loop"; t.Start(); //ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); return(true); } catch { flag = false; } return(flag); }
bool ISocket.StartListening(SocketConnectionAccepted callback) { var any = IPAddress.Any; if (Program.LaunchParameters.TryGetValue("-ip", out var ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } _isListening = true; _listenerCallback = callback; if (_listener == null) { _listener = new TcpListener(any, Netplay.ListenPort); } try { _listener.Start(); } catch (Exception) { return(false); } ThreadPool.QueueUserWorkItem(ListenLoop); return(true); }
public bool StartListening(SocketConnectionAccepted callback) { _disconnect = false; var any = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } _listener = new TcpListener(any, Netplay.ListenPort); try { this._listener.Start(); } catch (Exception) { return(false); } (new System.Threading.Thread(ListenThread)).Start(callback); (new System.Threading.Thread(DrainThread)).Start(); return(true); }
bool ISocket.StartListening(SocketConnectionAccepted callback) { var address = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out address)) { address = IPAddress.Any; } this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(address, Netplay.ListenPort); } try { this._listener.Start(); } catch (Exception ex) { return(false); } ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); return(true); }
bool ISocket.StartListening(SocketConnectionAccepted callback) { IPAddress address = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out address)) { address = IPAddress.Any; } this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(address, Netplay.ListenPort); } try { this._listener.Start(); } catch (Exception ex) { return(false); } new Thread(new ThreadStart(this.ListenLoop)) { IsBackground = true, Name = "TCP Listen Thread" }.Start(); return(true); }
public bool StartListening(SocketConnectionAccepted callback) { _disconnect = false; var any = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } _listener = new TcpListener(any, Netplay.ListenPort); try { this._listener.Start(); } catch (Exception) { return false; } (new System.Threading.Thread(ListenThread)).Start(callback); (new System.Threading.Thread(DrainThread)).Start(); return true; }
bool ISocket.StartListening(SocketConnectionAccepted callback) { IPAddress any = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(any, Netplay.ListenPort); } try { this._listener.Start(); } catch (Exception) { return(false); } _limiter = new Limiter(_config); new Thread(this.ListenLoop).Start(); return(true); }
public bool StartListening(SocketConnectionAccepted callback) { if (_server == null) { _server = new AsyncServerSocket(callback); } return(_server.Listen()); }
bool ISocket.StartListening(SocketConnectionAccepted callback) { this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(IPAddress.Any, Netplay.ListenPort); } try { this._listener.Start(); } catch { return(false); } ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); return(true); }
public bool StartListening(SocketConnectionAccepted callback) { var any = IPAddress.Any; string ipString; if (Program.LaunchParameters.TryGetValue("-ip", out ipString) && !IPAddress.TryParse(ipString, out any)) { any = IPAddress.Any; } _server = new SocketServer(any, Netplay.ListenPort); _server.SetConnectionAcceptedCallback((socket) => { socket.NoDelay = true; var imp = new AsyncSocket(socket); Console.WriteLine(imp.GetRemoteAddress() + " is connecting..."); callback(imp); }); return(_server.Start()); }
public override bool StartListening(SocketConnectionAccepted callback) { return(false); }
bool Terraria.Net.Sockets.ISocket.StartListening(SocketConnectionAccepted callback) { return(SocialAPI.Network.StartListening(callback)); }
public bool StartListening(SocketConnectionAccepted callback) { throw new NotImplementedException(); }
bool ISocket.StartListening(SocketConnectionAccepted callback) { return SocialAPI.Network.StartListening(callback); }
public override bool StartListening(SocketConnectionAccepted callback) { this._acceptingClients = true; this._connectionAcceptedCallback = callback; return(true); }
public abstract bool StartListening(SocketConnectionAccepted callback);
bool Terraria.Net.Sockets.ISocket.StartListening(SocketConnectionAccepted callback) { return SocialAPI.Network.StartListening(callback); }
public override bool StartListening(SocketConnectionAccepted callback) { this._acceptingClients = true; this._connectionAcceptedCallback = callback; return true; }
bool ISocket.StartListening(SocketConnectionAccepted callback) { #if Full_API this._isListening = true; this._listenerCallback = callback; if (this._listener == null) { this._listener = new TcpListener(IPAddress.Any, Terraria.Netplay.ListenPort); } try { this._listener.Start(); } catch (Exception) { return false; } ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); #endif return true; }
void HandleNewRequest(object sender, Socket newSocket) { SocketConnectionAccepted?.Invoke(this, newSocket); }
public AsyncServerSocket(SocketConnectionAccepted callback) { _callback = callback; }
bool ISocket.StartListening(SocketConnectionAccepted callback) { this._isListening = true; this._listenerCallback = callback; if (this._listener == null) this._listener = new TcpListener(IPAddress.Any, Netplay.ListenPort); try { this._listener.Start(); } catch { return false; } ThreadPool.QueueUserWorkItem(new WaitCallback(this.ListenLoop)); return true; }
public override bool StartListening(SocketConnectionAccepted callback) { return false; }