コード例 #1
0
        /// <summary>
        /// Sends the P2PMessage directly over the socket. Accepts P2PDCMessage and P2PMessage objects.
        /// </summary>
        /// <param name="message"></param>
        public void SendMessage(NetworkMessage message)
        {
            // if it is a regular message convert it
            P2PDCMessage p2pMessage = message as P2PDCMessage;
            if (p2pMessage == null)
            {
                p2pMessage = new P2PDCMessage(message as P2PMessage);
            }

            SendMessage(p2pMessage, null);
        }
コード例 #2
0
 /// <summary>
 /// Constructs a NotificationMessage from the inner body contents of the specified message object.
 /// This will also set the InnerMessage property of the message object to the newly created NotificationMessage.
 /// </summary>
 public NotificationMessage(NetworkMessage message)
 {
     ParseBytes(message.InnerBody);
     message.InnerMessage = this;
 }
コード例 #3
0
        public virtual void SendMessage(NetworkMessage message, int transactionID)
        {
            NSMessage nsMessage = message as NSMessage;

            if (nsMessage == null)
            {
                Trace.WriteLineIf(Settings.TraceSwitch.TraceError,
                    "Cannot use this Message Processor to send a " + message.GetType().ToString() + " message.", GetType().Name);
                return;
            }

            nsMessage.TransactionID = transactionID;
            nsMessage.PrepareMessage();

            Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose,
                "Outgoing message:\r\n" + nsMessage.ToDebugString() + "\r\n", GetType().Name);

            // convert to bytes and send it over the socket
            Processor.Send(nsMessage.GetBytes(), transactionID);
        }
コード例 #4
0
 public void SendMessage(NetworkMessage message)
 {
     SendMessage(message, IncreaseTransactionID());
 }
コード例 #5
0
ファイル: NetworkMessage.cs プロジェクト: quynh68/msnp-sharp
        /// <summary>
        /// Creates the network message based on the inner contents of the parent message. It invokes the
        /// <see cref="ParseBytes"/> method to parse the inner body contents of the parent message.
        /// </summary>
        /// <param name="containerMessage"></param>
        public void CreateFromParentMessage(NetworkMessage containerMessage)
        {
            ParentMessage = containerMessage;
            ParentMessage.InnerMessage = this;

            if (ParentMessage.InnerBody != null)
                ParseBytes(ParentMessage.InnerBody);
        }
コード例 #6
0
 public virtual void SendMessage(NetworkMessage message)
 {
     Send(message.GetBytes());
 }
コード例 #7
0
ファイル: MimeMessage.cs プロジェクト: quynh68/msnp-sharp
        public P2PMimeMessage(string destString, string srcString, NetworkMessage payLoad)
            : base()
        {
            MimeHeader["P2P-Dest"] = destString;
            MimeHeader["P2P-Src"] = srcString;
            MimeHeader[MIMEContentHeaders.ContentType] = "application/x-msnmsgrp2p";

            InnerMessage = payLoad;
        }