public override bool SendTarget(PortalPacket p, ushort targetID, bool getResponse) { if (!CheckAlive()) { return(false); } var any = false; try { foreach (var c in Clients) { try { if (c.SendTarget(p, targetID, getResponse)) { any = true; } } catch { } } } catch { } return(any); }
public override bool SendExcept(PortalPacket p, ushort exceptID) { if (!CheckAlive()) { return(false); } var any = false; try { foreach (var c in Clients) { try { if (c.SendExcept(p, exceptID)) { any = true; } } catch { } } } catch { } return(any); }
private bool InternalSend(PortalPacket p, bool getResponse) { var buffer = p.Compile(); if (buffer == null) { ToConsole("Send: Buffer Null for {0}", p.ID); return(false); } if (buffer.Length < PortalPacket.MinSize || buffer.Length > PortalPacket.MaxSize) { ToConsole( "Send: Size Out Of Range for {0} at {1}/{2}-{3} bytes", p.ID, buffer.Length, PortalPacket.MinSize, PortalPacket.MaxSize); return(false); } lock (_SendLock) { var size = buffer.Length; while (size > 0 && _Client != null) { size -= _Client.Send(buffer, buffer.Length - size, size, SocketFlags.None); if (!_Client.Connected) { break; } Thread.Sleep(10); } if (size > 0) { ToConsole("Send: Failed for {0} at {1}/{2} bytes", p.ID, buffer.Length - size, buffer.Length); Dispose(); return(false); } ToConsole("Send: Sent Packet {0} at {1} bytes", p.ID, buffer.Length); } if (getResponse) { Receive(); } ProcessReceiveQueue(); return(true); }
public override bool SendTarget(PortalPacket p, ushort targetID) { if (!IsAlive) { return(false); } var any = 0; foreach (var c in Clients) { if (c.SendTarget(p, targetID)) { ++any; } } return(any > 0); }
public override bool Send(PortalPacket p) { if (!IsAlive) { return(false); } var any = 0; foreach (var c in Clients) { if (c.Send(p)) { ++any; } } return(any > 0); }
public override bool Send(PortalPacket p) { return(CheckAlive() && InternalSend(p)); }
public override bool SendTarget(PortalPacket p, ushort targetID) { return CheckAlive() && _ServerID == targetID && InternalSend(p); }
public abstract bool Send(PortalPacket p);
public abstract bool SendExcept(PortalPacket p, ushort exceptID, bool getResponse);
public bool SendTarget(PortalPacket p, ushort targetID) { return(SendTarget(p, targetID, false)); }
public override bool Send(PortalPacket p) { if (!CheckAlive()) { return false; } var any = false; try { foreach (var c in Clients) { try { if (c.Send(p)) { any = true; } } catch { } } } catch { } return any; }
public bool SendExcept(PortalPacket p, ushort exceptID) { return SendExcept(p, exceptID, false); }
public static bool SendExcept(PortalPacket p, ushort exceptID, bool getResponse) { return IsAlive && Transport.SendExcept(p, exceptID, getResponse); }
public static bool SendExcept(PortalPacket p, ushort exceptID) { return IsAlive && Transport.SendExcept(p, exceptID); }
public static bool Send(PortalPacket p, bool getResponse) { return IsAlive && Transport.Send(p, getResponse); }
public static bool Send(PortalPacket p) { return IsAlive && Transport.Send(p); }
public abstract bool SendTarget(PortalPacket p, ushort targetID);
public abstract bool SendExcept(PortalPacket p, ushort exceptID);
public override bool SendExcept(PortalPacket p, ushort exceptID) { return(CheckAlive() && _ServerID != exceptID && InternalSend(p)); }
public bool Send(PortalPacket p) { return Send(p, false); }
public static bool SendTarget(PortalPacket p, ushort targetID, bool getResponse) { return IsAlive && Transport.SendTarget(p, targetID, getResponse); }
public bool SendTarget(PortalPacket p, ushort targetID) { return SendTarget(p, targetID, false); }
private bool InternalSend(PortalPacket p, bool getResponse) { var buffer = p.Compile(); if (buffer == null) { ToConsole("Send: Buffer Null for {0}", p.ID); return false; } if (buffer.Length < PortalPacket.MinSize || buffer.Length > PortalPacket.MaxSize) { ToConsole( "Send: Size Out Of Range for {0} at {1}/{2}-{3} bytes", p.ID, buffer.Length, PortalPacket.MinSize, PortalPacket.MaxSize); return false; } lock (_SendLock) { var size = buffer.Length; while (size > 0 && _Client != null) { size -= _Client.Send(buffer, buffer.Length - size, size, SocketFlags.None); if (!_Client.Connected) { break; } Thread.Sleep(10); } if (size > 0) { ToConsole("Send: Failed for {0} at {1}/{2} bytes", p.ID, buffer.Length - size, buffer.Length); Dispose(); return false; } ToConsole("Send: Sent Packet {0} at {1} bytes", p.ID, buffer.Length); } if (getResponse) { Receive(); } ProcessReceiveQueue(); return true; }
public override bool Send(PortalPacket p, bool getResponse) { return CheckAlive() && InternalSend(p, getResponse); }
public static bool SendTarget(PortalPacket p, ushort targetID) { return(IsAlive && Transport.SendTarget(p, targetID)); }
public abstract bool Send(PortalPacket p, bool getResponse);
public override bool Send(PortalPacket p) { return CheckAlive() && InternalSend(p); }
public abstract bool SendTarget(PortalPacket p, ushort targetID, bool getResponse);
public override bool Send(PortalPacket p, bool getResponse) { return(CheckAlive() && InternalSend(p, getResponse)); }
public static bool Send(PortalPacket p) { return(IsAlive && Transport.Send(p)); }
public static bool SendExcept(PortalPacket p, ushort exceptID) { return(IsAlive && Transport.SendExcept(p, exceptID)); }
public override bool SendExcept(PortalPacket p, ushort exceptID) { return CheckAlive() && _ServerID != exceptID && InternalSend(p); }
private bool InternalSend(PortalPacket p) { if (!IsAlive) { return false; } var buffer = p.Compile(); if (buffer == null) { if (_DisplaySendOutput) { ToConsole("Send: Buffer Null for {0}", p.ID); } return false; } var size = buffer.Length; if (size < PortalPacket.MinSize || size > PortalPacket.MaxSize) { if (_DisplaySendOutput) { ToConsole( "Send: Size Out Of Range for {0} at {1}/{2}-{3} bytes", p.ID, size, PortalPacket.MinSize, PortalPacket.MaxSize); } return false; } var length = size; lock (_SendLock) { while (length > 0 && _Client != null) { length -= _Client.Send(buffer, size - length, length, SocketFlags.None); if (!_Client.Connected || length <= 0) { break; } Thread.Sleep(10); } } if (length > 0) { if (_DisplaySendOutput) { ToConsole("Send: Failed for {0} at {1}/{2} bytes", p.ID, size - length, size); } return false; } if (_DisplaySendOutput) { ToConsole("Send: Sent Packet {0} at {1} bytes", p.ID, size); } lock (_GetResponseLock) { if (p.GetResponse) { Receive(); ProcessReceiveQueue(); } } return true; }
public static bool Send(PortalPacket p, bool getResponse) { return(IsAlive && Transport.Send(p, getResponse)); }
public override bool SendTarget(PortalPacket p, ushort targetID) { return(CheckAlive() && _ServerID == targetID && InternalSend(p)); }
public static bool SendExcept(PortalPacket p, ushort exceptID, bool getResponse) { return(IsAlive && Transport.SendExcept(p, exceptID, getResponse)); }
private bool InternalSend(PortalPacket p) { if (!IsAlive) { return(false); } var buffer = p.Compile(); if (buffer == null) { if (_DisplaySendOutput) { ToConsole("Send: Buffer Null for {0}", p.ID); } return(false); } var size = buffer.Length; if (size < PortalPacket.MinSize || size > PortalPacket.MaxSize) { if (_DisplaySendOutput) { ToConsole( "Send: Size Out Of Range for {0} at {1}/{2}-{3} bytes", p.ID, size, PortalPacket.MinSize, PortalPacket.MaxSize); } return(false); } var length = size; lock (_SendLock) { while (length > 0 && _Client != null) { length -= _Client.Send(buffer, size - length, length, SocketFlags.None); if (!_Client.Connected || length <= 0) { break; } Thread.Sleep(10); } } if (length > 0) { if (_DisplaySendOutput) { ToConsole("Send: Failed for {0} at {1}/{2} bytes", p.ID, size - length, size); } return(false); } if (_DisplaySendOutput) { ToConsole("Send: Sent Packet {0} at {1} bytes", p.ID, size); } lock (_GetResponseLock) { if (p.GetResponse) { Receive(); ProcessReceiveQueue(); } } return(true); }
public override bool Send(PortalPacket p) { return(InternalSend(p)); }
private bool InternalSend(PortalPacket p) { if (p == null) { return(false); } if (IsDisposing && p.ID != 255) { return(false); } if (!IsAlive) { return(false); } /* * while (!_ReceiveSync.WaitOne(10)) * { * if (!IsAlive || (Portal.Ticks % 1000 == 0 && !IsConnected)) * { * return false; * } * * Thread.Sleep(1); * } */ if (IsDisposing && p.ID != 255) { return(false); } if (!IsAlive) { return(false); } try { _NoReceive = true; var buffer = p.Compile(); if (buffer == null) { if (_DisplaySendOutput) { ToConsole("Send: Buffer Null for {0}", p.ID); } Dispose(); return(false); } var size = buffer.Size; if (size < PortalPacket.MinSize || size > PortalPacket.MaxSize) { if (_DisplaySendOutput) { ToConsole( "Send: Size Out Of Range for {0} at {1} / {2} - {3} bytes", p.ID, size, PortalPacket.MinSize, PortalPacket.MaxSize); } Dispose(); return(false); } var length = buffer.Send(_Client, 0, size); if (length < size) { if (_DisplaySendOutput) { ToConsole("Send: Failed for {0} at {1} / {2} bytes", p.ID, length, size); } Dispose(); return(false); } if (_DisplaySendOutput) { ToConsole("Send: Packet {0} at {1} bytes", p.ID, size); } if (p.GetResponse) { if (!Receive(true)) { if (_DisplaySendOutput) { ToConsole("Send: {0} requires a response which could not be handled.", p.ID); } Dispose(); return(false); } ProcessReceiveQueue(); } _NoReceive = false; return(true); } catch (Exception e) { ToConsole("Send: Exception Thrown", e); Dispose(); return(false); } finally { _NoReceive = false; } }
public bool Send(PortalPacket p) { return(Send(p, false)); }
public bool SendExcept(PortalPacket p, ushort exceptID) { return(SendExcept(p, exceptID, false)); }
public override bool SendTarget(PortalPacket p, ushort targetID) { if (!CheckAlive()) { return false; } var any = false; try { foreach (var c in Clients) { try { if (c.SendTarget(p, targetID)) { any = true; } } catch { } } } catch { } return any; }
public override bool SendExcept(PortalPacket p, ushort exceptID, bool getResponse) { if (!CheckAlive()) { return false; } var any = false; try { foreach (var c in Clients) { try { if (c.SendExcept(p, exceptID, getResponse)) { any = true; } } catch { } } } catch { } return any; }