Aegis.Network.SessionMethodAsyncResult.SendPacket C# (CSharp) Method

SendPacket() public method

public SendPacket ( byte buffer, int offset, int size, Action onSent = null ) : void
buffer byte
offset int
size int
onSent Action
return void
        public void SendPacket(byte[] buffer, int offset, int size, Action<StreamBuffer> onSent = null)
        {
            try
            {
                lock (_session)
                {
                    if (_session.Socket != null)
                    {
                        if (onSent == null)
                            _session.Socket.BeginSend(buffer, offset, size, SocketFlags.None, Socket_Send, null);
                        else
                            _session.Socket.BeginSend(buffer, offset, size, SocketFlags.None, Socket_Send,
                                             new NetworkSendToken(new StreamBuffer(buffer, offset, size), onSent));
                    }
                }
            }
            catch (SocketException)
            {
            }
            catch (Exception e)
            {
                Logger.Err(LogMask.Aegis, e.ToString());
            }
        }

Same methods

SessionMethodAsyncResult::SendPacket ( StreamBuffer buffer, Action onSent = null ) : void
SessionMethodAsyncResult::SendPacket ( StreamBuffer buffer, PacketPredicate predicate, IOEventHandler dispatcher, Action onSent = null ) : void