protected virtual void ReceiveAsync(object sender, SocketAsyncEventArgs e) { if (e.BytesTransferred > 0) { Mithril.Buffer buffer = new Mithril.Buffer(e.Buffer); buffer.Set(e.BytesTransferred); if (EndPointIds.ContainsKey(e.RemoteEndPoint)) { Connections[EndPointIds[e.RemoteEndPoint]].OnReceive(buffer); } } Handle.Set(); }
public void SendReliable(int connectionId, Mithril.Buffer buffer, bool wholeBuffer = true) { Connections[connectionId]?.SendReliable(buffer, wholeBuffer); }
public void FireReceiveEvent(int connectionId, Mithril.Buffer buffer) { Receive?.Invoke(connectionId, buffer); }
public BufferTests() { buffer = new Mithril.Buffer(); bigBuffer = new Mithril.Buffer(BIG_BUFFER_SIZE); r = new Random(); }