public void Close(bool isCallback = true) { if (socket != null) { socket.Close(); } if (currentPackage != null) { currentPackage.Clear(); } if (readStream != null) { readStream.Close(); } if (binaryReader != null) { binaryReader.Close(); } if (writeStream != null) { writeStream.Close(); } if (binaryWriter != null) { binaryWriter.Close(); } currentPackage = null; receiveThread = null; socket = null; CloseCheckConnectingTimer(); CloseCheckConnectedTimer(); if (isCallback) { SetState(ConnectState.Close); } }
private void CreateMessage(StreamPackage package) { receiveCallback(package.msgType, package.msgBytes); package.Clear(); }