LumiSoft.Net.SocketLogger.AddSendEntry C# (CSharp) Method

AddSendEntry() public method

Adds data send(to remoteEndpoint) entry.
public AddSendEntry ( string text, long size ) : void
text string
size long
return void
        public void AddSendEntry(string text,long size)
        {
            m_pEntries.Add(new SocketLogEntry(text,size,SocketLogEntryType.SendToRemoteEP));

            s += CreateEntry(text,"<<<");
        }

Usage Example

Example #1
0
        /// <summary>
        /// Sends line to socket.
        /// </summary>
        /// <param name="line"></param>
        public void SendLine(string line)
        {
            if (!line.EndsWith("\r\n"))
            {
                line += "\r\n";
            }

            byte[] data        = m_pEncoding.GetBytes(line);
            int    countSended = m_pSocket.Send(data);

            if (countSended != data.Length)
            {
                throw new Exception("Send error, didn't send all bytes !");
                // ToDo: if this happens just try to resend unsent bytes
            }

            // Logging stuff
            if (m_pLogger != null)
            {
                m_pLogger.AddSendEntry(line);
            }

            OnActivity();
        }