/// <summary>
        /// Sends a message synchronously. Does not process exceptions!
        /// </summary>
        /// <param name="message">Message.</param>
        /// <param name="tcpSocketInfo">Acquired connection.</param>
        public void LowLevel_SendSync(Message message, TcpSocketInfo tcpSocketInfo)
        {
            Stream stream = null;
            BinaryLogWriter binaryLogWriter = this.ITransportContext.BinaryLogWriter;

            // LOG:
            if ( binaryLogWriter != null && binaryLogWriter[LogCategory.Transport] > 0 )
                binaryLogWriter.WriteEvent(LogCategory.Transport, "TcpConnectionManager.LowLevel_SendSync",
                    LogMessageType.MessageIsSentSynchronously, null, message, message.Recipient, null,
                    GenuineUtility.CurrentThreadId, Thread.CurrentThread.Name,
                    tcpSocketInfo.ConnectionLevelSecurity == null ? null : tcpSocketInfo.ConnectionLevelSecurity,
                    tcpSocketInfo.ConnectionLevelSecurity == null ? null : tcpSocketInfo.ConnectionLevelSecurity.Name,
                    tcpSocketInfo.DbgConnectionId, 0, 0, 0, null, null, null, null,
                    "The connection has been obtained and the message is being sent synchronously.");

            try
            {
                // PING: prevent a ping
                if (tcpSocketInfo.GenuineConnectionType == GenuineConnectionType.Persistent)
                    tcpSocketInfo.LastTimeContentWasSent = GenuineUtility.TickCount;

                tcpSocketInfo.SetupWriting(message.FinishTime);

                // create a stream
                bool finished = false;

                // enable connection-level security encryption
                stream = message.SerializedContent;
                if (tcpSocketInfo.ConnectionLevelSecurity != null)
                {
                    GenuineChunkedStream encryptedContentStream = new GenuineChunkedStream(true);
                    tcpSocketInfo.ConnectionLevelSecurity.Encrypt(stream, encryptedContentStream);
                    stream = encryptedContentStream;
                }

                // send it in chunks
                while ( ! finished )
                {
                    int currentPosition = HEADER_SIZE;

                    // read data
                    int size = 0;
                    while ( tcpSocketInfo._sendBuffer.Length > currentPosition &&
                        (size = stream.Read(tcpSocketInfo._sendBuffer, currentPosition, tcpSocketInfo._sendBuffer.Length - currentPosition)) > 0)
                    {
                        if (size <= 0)
                            break;

                        currentPosition += size;
                    }

                    finished = currentPosition < tcpSocketInfo._sendBuffer.Length;
                    int totalSize = currentPosition;

                    // prepare header
                    tcpSocketInfo._sendBuffer[0] = MessageCoder.COMMAND_MAGIC_CODE;
                    MessageCoder.WriteInt32(tcpSocketInfo._sendBuffer, 1, totalSize - HEADER_SIZE);
                    tcpSocketInfo._sendBuffer[5] = finished ? (byte) 1 : (byte) 0;

                    // and send it
                    currentPosition = 0;
                    tcpSocketInfo.Write(tcpSocketInfo._sendBuffer, currentPosition, totalSize);
                    this.IncreaseBytesSent(totalSize);
                }

                // the message can be resent only if the persistent pattern is used
                if (tcpSocketInfo.GenuineConnectionType == GenuineConnectionType.Persistent  && ! (bool) this.ITransportContext.IParameterProvider[GenuineParameter.TcpDoNotResendMessages])
                    tcpSocketInfo.MessagesSentSynchronously.PutMessage(message);
            }
            catch(Exception ex)
            {
                // LOG:
                if ( binaryLogWriter != null && binaryLogWriter[LogCategory.Transport] > 0 )
                    binaryLogWriter.WriteEvent(LogCategory.Transport, "TcpConnectionManager.LowLevel_SendSync",
                        LogMessageType.MessageIsSentSynchronously, ex, message, message.Recipient, null,
                        GenuineUtility.CurrentThreadId, Thread.CurrentThread.Name,
                        tcpSocketInfo.ConnectionLevelSecurity == null ? null : tcpSocketInfo.ConnectionLevelSecurity,
                        tcpSocketInfo.ConnectionLevelSecurity == null ? null : tcpSocketInfo.ConnectionLevelSecurity.Name,
                        tcpSocketInfo.DbgConnectionId, 0, 0, 0, null, null, null, null,
                        "The exception occurred while synchronous sending.");

                throw;
            }
            finally
            {
                lock (tcpSocketInfo)
                    tcpSocketInfo.LockForSending = false;
            }

            // the message was sent
            // PING: schedule a ping
            if (tcpSocketInfo.GenuineConnectionType == GenuineConnectionType.Persistent)
                tcpSocketInfo.LastTimeContentWasSent = GenuineUtility.TickCount;
        }