Ejemplo n.º 1
0
        /// <summary>
        /// Send a model message asynchronously.
        /// </summary>
        /// <param name="clientID">The client's id to send message.</param>
        /// <param name="model">The model to be sent.</param>
        /// <param name="callback">The callback delegate that will be called when the asynchronous operation finished.</param>
        /// <returns></returns>
        public IAsyncResult SendModelMessageAsync(long clientID, object model, AsyncCallback callback)
        {
            GeneralMessage generalMsg = TcpModelConverter.Default.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            return(SendMessageAsync(clientID, generalMsg.Serialize(), callback));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Send a model message.
        /// </summary>
        /// <param name="clientID">The destination client id to send message.</param>
        /// <param name="model">The model to be sent.</param>
        public void SendModelMessage(long clientID, object model)
        {
            GeneralMessage generalMsg = TcpModelConverter.Default.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            SendMessage(clientID, generalMsg.Serialize());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Send a model message to a collection of group asynchronously.
        /// </summary>
        /// <param name="groupNameCollection">The group collection to receive the model message.</param>
        /// <param name="model">The model to be sent.</param>
        /// <param name="callback">The callback delegate that will be called when the asynchronous operation finished.</param>
        /// <param name="state">User defined state.</param>
        /// <param name="loopBack">True if the message returns to the sender; otherwise false. The default is false.</param>
        public IAsyncResult SendGroupModelMessageAsync(IEnumerable <string> groupNameCollection, object model, AsyncCallback callback, object state, bool loopBack = false)
        {
            GeneralMessage generalMsg = _modelConvert.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            return(SendGroupMessageAsync(groupNameCollection, generalMsg.Serialize(), callback, state, loopBack));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Send a model message to a collection of group.
        /// </summary>
        /// <param name="groupNameCollection">The group collection to receive the model message.</param>
        /// <param name="model">The model to be sent.</param>
        /// <param name="loopBack">True if the message returns to the sender; otherwise false. The default is false.</param>
        public void SendGroupModelMessage(IEnumerable <string> groupNameCollection, object model, bool loopBack = false)
        {
            GeneralMessage generalMsg = _modelConvert.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            SendGroupMessage(groupNameCollection, generalMsg.Serialize(), loopBack);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Send a model message asynchronously.
        /// </summary>
        /// <param name="model">The model to be sent.</param>
        /// <param name="callback">The callback delegate that will be called when the asynchronous operation finished.</param>
        /// <param name="state">User defined state.</param>
        /// <returns></returns>
        public IAsyncResult SendModelMessageAsync(object model, AsyncCallback callback, object state)
        {
            GeneralMessage generalMsg = _modelConvert.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            return(SendMessageAsync(generalMsg.Serialize(), callback, state));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Send a model message.
        /// </summary>
        /// <param name="model">The model to be sent.</param>
        public void SendModelMessage(object model)
        {
            GeneralMessage generalMsg = _modelConvert.ToMessage(model);

            generalMsg.Header = _modelHeaderIndicator;
            SendMessage(generalMsg.Serialize());
        }