public override void Send(byte[] buffer, int length, RecordAfterWrite writeBack = null) { writeBack?.Invoke(buffer, length, true); if (_Socket == null || buffer == null || length <= 0) { return; } try { SendQueue.Gram gram; lock (_SendLockMutex) { lock (_SendQueue) { gram = _SendQueue.Enqueue(buffer, length); } if (gram != null && !_sending) { _sending = true; try { _Socket.BeginSend(gram.Buffer, 0, gram.Length, SocketFlags.None, _OnSendComplete, _Socket); } catch (Exception ex) { TraceException(ex); Dispose(false); } } } } catch (CapacityExceededException) { Kernel.WriteLine(TypeName, $"{this} has too much data pending, disconnecting."); Dispose(false); } }
public void Send(byte[] buffer, int length, RecordAfterWrite writeBack = null) { writeBack?.Invoke(buffer, length, true); if (buffer[0x05] == (byte)EHandshake.ServerHelloDone) { _Server.ReceiveHttps(this, ClientKeyExchange0, ClientKeyExchange0.Length); _Server.ReceiveHttps(this, ClientChangeCipherSpecAndConfirm0, ClientChangeCipherSpecAndConfirm0.Length); } else if (buffer[0x05] == 0x2D) // finished { _Server.ReceiveHttps(this, ClientFirstDataPacket0, ClientFirstDataPacket0.Length); } else if (buffer[0x00] == 23) // application data { } }