public static void SocialClientLoop(object threadContext) { ISocket socket = (ISocket)threadContext; Netplay.ClientLoopSetup(socket.GetRemoteAddress()); Netplay.Connection.Socket = socket; }
private static void OnConnectionAccepted(ISocket client) { int num = Netplay.FindNextOpenClientSlot(); if (num != -1) { Netplay.Clients[num].Socket = client; Netplay.Clients[num].sendQueue.StartThread(); Console.WriteLine(client.GetRemoteAddress() + " is connecting to slot {0}...", num); } else { using (var stream = new MemoryStream()) { using (var writer = new BinaryWriter(stream)) { writer.Write((short)0); writer.Write((byte)2); writer.Write("Server is full."); short position = (short)writer.BaseStream.Position; writer.BaseStream.Position = 0L; writer.Write((short)position); byte[] data = stream.ToArray(); client.AsyncSend(data, 0, data.Length, delegate { }); } } client.Close(); } }
private static void KickClient(ISocket client, NetworkText kickMessage) { BinaryWriter writer = fullBuffer.writer; if (writer == null) { fullBuffer.ResetWriter(); writer = fullBuffer.writer; } writer.BaseStream.Position = 0L; long position = writer.BaseStream.Position; writer.BaseStream.Position += 2L; writer.Write((byte)2); kickMessage.Serialize(writer); if (Main.dedServ) { Console.WriteLine(Language.GetTextValue("CLI.ClientWasBooted", client.GetRemoteAddress().ToString(), kickMessage)); } int num = (int)writer.BaseStream.Position; writer.BaseStream.Position = position; writer.Write((short)num); writer.BaseStream.Position = num; client.AsyncSend(fullBuffer.writeBuffer, 0, num, ServerFullWriteCallBack, client); }
private static void OnConnectionAccepted(ISocket client) { int num = FindNextOpenClientSlot(); if (num != -1) { Clients[num].Reset(); Clients[num].Socket = client; Console.WriteLine(string.Concat(client.GetRemoteAddress(), " is connecting...")); } else { lock (fullBuffer) { BinaryWriter writer = fullBuffer.writer; if (writer == null) { fullBuffer.ResetWriter(); writer = fullBuffer.writer; } writer.BaseStream.Position = 0L; long position = writer.BaseStream.Position; writer.BaseStream.Position += 2L; writer.Write((byte)2); string value = Lang.mobile[62].Value; writer.Write(value); if (Main.dedServ) { Console.WriteLine(client.GetRemoteAddress().ToString() + " was booted: " + value); } int num2 = (int)writer.BaseStream.Position; writer.BaseStream.Position = position; writer.Write((short)num2); writer.BaseStream.Position = num2; client.AsyncSend(fullBuffer.writeBuffer, 0, num2, ServerFullWriteCallBack, client); } } }
private static void OnConnectionAccepted(ISocket client) { int nextOpenClientSlot = Netplay.FindNextOpenClientSlot(); if (nextOpenClientSlot != -1) { Netplay.Clients[nextOpenClientSlot].Socket = client; Console.WriteLine((string)(object)client.GetRemoteAddress() + (object)" is connecting..."); } if (Netplay.FindNextOpenClientSlot() != -1) { return; } Netplay.StopListening(); }
// Token: 0x06000159 RID: 345 RVA: 0x0002AA6C File Offset: 0x00028C6C private static void OnConnectionAccepted(ISocket client) { int num = Netplay.FindNextOpenClientSlot(); if (num != -1) { Netplay.Clients[num].Reset(); Netplay.Clients[num].Socket = client; Console.WriteLine(Language.GetTextValue("Net.ClientConnecting", client.GetRemoteAddress())); } if (Netplay.FindNextOpenClientSlot() == -1) { Netplay.StopListening(); } }
private static void OnConnectionAccepted(ISocket client) { int num = Netplay.FindNextOpenClientSlot(); if (num != -1) { Netplay.Clients[num].Reset(); Netplay.Clients[num].Socket = client; Console.WriteLine(client.GetRemoteAddress() + " is connecting..."); } if (Netplay.FindNextOpenClientSlot() == -1) { Netplay.StopListening(); } }
private void ListenLoop(object unused) { while (this._isListening) { if (!Netplay.disconnect) { try { ISocket client = (ISocket) new TcpSocket(this._listener.AcceptTcpClient()); Console.WriteLine((string)(object)client.GetRemoteAddress() + (object)" is connecting..."); this._listenerCallback(client); } catch { } } else { break; } } this._listener.Stop(); }
private void UpdateStatusText() { if (StatusMax > 0 && StatusText2 != "") { if (StatusCount >= StatusMax) { StatusText = Language.GetTextValue("Net.ClientStatusComplete", Socket.GetRemoteAddress(), Name, StatusText2); StatusText2 = ""; StatusMax = 0; StatusCount = 0; } else { StatusText = "(" + Socket.GetRemoteAddress() + ") " + Name + " " + StatusText2 + ": " + (int)((float)StatusCount / (float)StatusMax * 100f) + "%"; } } else if (State == 0) { StatusText = Language.GetTextValue("Net.ClientConnecting", $"({Socket.GetRemoteAddress()}) {Name}"); } else if (State == 1) { StatusText = Language.GetTextValue("Net.ClientSendingData", Socket.GetRemoteAddress(), Name); } else if (State == 2) { StatusText = Language.GetTextValue("Net.ClientRequestedWorldInfo", Socket.GetRemoteAddress(), Name); } else if (State != 3 && State == 10) { try { StatusText = Language.GetTextValue("Net.ClientPlaying", Socket.GetRemoteAddress(), Name); } catch (Exception) { PendingTermination = true; } } }
private void ListenLoop() { while (this._isListening) { if (!Netplay.Disconnect) { try { ISocket client = (ISocket) new TcpSocket(this._listener.AcceptTcpClient()); Console.WriteLine(Language.GetTextValue("Net.ClientConnecting", (object)client.GetRemoteAddress())); this._listenerCallback(client); } catch (Exception ex) { } } else { break; } } this._listener.Stop(); }
private static void OnConnectionAccepted(ISocket client) { int num = Netplay.FindNextOpenClientSlot(); if (num != -1) { Netplay.Clients[num].Socket = client; Netplay.Clients[num].sendQueue.StartThread(); Console.WriteLine(client.GetRemoteAddress() + " is connecting to slot {0}...", num); } if (Netplay.FindNextOpenClientSlot() == -1) { Console.WriteLine("Netplay: No more clients can connect!"); Netplay.StopListening(); } }
private static void OnConnectionAccepted(ISocket client) { var nextOpenClientSlot = Netplay.FindNextOpenClientSlot(); if (nextOpenClientSlot != -1) { Netplay.Clients[nextOpenClientSlot].Reset(); Netplay.Clients[nextOpenClientSlot].Socket = client; Console.WriteLine(Language.GetTextValue("Net.ClientConnecting", (object)client.GetRemoteAddress())); } if (Netplay.FindNextOpenClientSlot() != -1) { return; } Netplay.StopListening(); }
private static void OnConnectionAccepted(ISocket client) { int nextOpenClientSlot = Netplay.FindNextOpenClientSlot(); if (nextOpenClientSlot != -1) { Netplay.Clients[nextOpenClientSlot].Socket = client; Console.WriteLine((string)(object)client.GetRemoteAddress() + (object)" is connecting..."); } if (Netplay.FindNextOpenClientSlot() != -1) return; Netplay.StopListening(); }
private static void KickClient(ISocket client, NetworkText kickMessage) { BinaryWriter writer = Netplay.fullBuffer.writer; if (writer == null) { Netplay.fullBuffer.ResetWriter(); writer = Netplay.fullBuffer.writer; } writer.BaseStream.Position = 0L; long position1 = writer.BaseStream.Position; writer.BaseStream.Position += 2L; writer.Write((byte)2); kickMessage.Serialize(writer); if (Main.dedServ) { Console.WriteLine(Language.GetTextValue("CLI.ClientWasBooted", (object)client.GetRemoteAddress().ToString(), (object)kickMessage)); } int position2 = (int)writer.BaseStream.Position; writer.BaseStream.Position = position1; writer.Write((short)position2); writer.BaseStream.Position = (long)position2; client.AsyncSend(Netplay.fullBuffer.writeBuffer, 0, position2, new SocketSendCallback(Netplay.ServerFullWriteCallBack), (object)client); }