internal SocketBuffer(byte[] buffer, IBufferListener bufferListener, SocketAsyncEventArgs socketArgs) { _mutex = new object(); _bufferListener = bufferListener; Buffer = buffer; SocketEventArgs = socketArgs; }
internal SocketBuffer CreateSocketBuffer(IBufferListener bufferListener) { var buffer = new byte[_bufferSize]; var eventArgs = new SocketAsyncEventArgs(); eventArgs.RemoteEndPoint = _clientManger.ClientSocket.RemoteEndPoint; eventArgs.Completed += _clientManger.ConnectionManager.OnReceiveBuffer; eventArgs.SetBuffer(buffer, 0, 0); return(new SocketBuffer(buffer, bufferListener, eventArgs)); }