public bool Send(Socket socket, NotifyType notifyType, BaseInfo sendInfo) { try { if (socket.Connected == false) // auto { return(true); } int sendSize = 4 + sendInfo.GetSize(); HeaderInfo headerInfo = new HeaderInfo(); headerInfo._BodySize = sendSize; byte[] btBuffer = new byte[headerInfo.GetSize() + sendSize]; MemoryStream ms = new MemoryStream(btBuffer, true); BinaryWriter bw = new BinaryWriter(ms); headerInfo.GetBytes(bw); EncodeInteger(bw, (int)notifyType); sendInfo.GetBytes(bw); bw.Close(); ms.Close(); socket.Send(btBuffer); } catch (Exception e) { _NotifyHandler(NotifyType.Notify_Socket, socket, null); return(false); } return(true); }