Exemple #1
0
        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);
            }
        }
Exemple #2
0
 private void CreateMessage(StreamPackage package)
 {
     receiveCallback(package.msgType, package.msgBytes);
     package.Clear();
 }