コード例 #1
0
        /// <summary>
        /// Send data through an UDPChannel to all the clients and returns an array of <see cref="UDPDataInfo"/> objects.</summary>
        /// <param name='channelName'>The name of the channel you want to send your message through.</param>
        /// <c>It must be registered on this instance, if a channel with that name can't be found the method will throw an exception!</c>
        /// <remarks>You can check if the name is registered by calling <see cref="GetChannelByName"/></remarks>
        /// <param name="udpData">A literal object that contains the data to send</param>
        public List <UDPDataInfo> SendToAll(string channelName, object udpData)
        {       //sendToAllClients
            int max = _peers.Count;

            if (max == 0)
            {
                return(null);
            }
            List <UDPDataInfo> ret = new List <UDPDataInfo>();

            for (int i = 0; i < max; i++)
            {
                ret.Add(_udpManager.Send(channelName, udpData, _peers[i].Address, _peers[i].Port));
            }
            return(ret);
        }
コード例 #2
0
 /// <summary>
 /// Send data through an UDPChannel to a distant user and returns an <see cref="UDPDataInfo"/> object.</summary>
 /// <param name='channelName'>The name of the channel you want to send your message through.</param>
 /// <c>It must be registered on this instance, if a channel with that name can't be found the method will throw an exception!</c>
 /// <remarks>You can check if the name is registered by calling <see cref="GetChannelByName"/></remarks>
 /// <param name="udpData">A <see cref="JavaScriptObject"/> that contains the data to send</param>
 /// <param name="remoteAddress">The IPV4 address of the target</param>
 /// <param name="remotePort">The port of the target</param>
 public UDPDataInfo Send(string channelName, object udpData, string remoteAddress, int remotePort)
 {
     return(udpm.Send(channelName, udpData, remoteAddress, remotePort));
 }
コード例 #3
0
 /// <summary>
 /// Send data through an UDPChannel to the server and returns an <see cref="UDPDataInfo"/> object.</summary>
 /// <param name='channelName'>The name of the channel you want to send your message through.</param>
 /// <c>It must be registered on this instance, if a channel with that name can't be found the method will throw an exception!</c>
 /// <remarks>You can check if the name is registered by calling <see cref="GetChannelByName"/></remarks>
 /// <param name="udpData">A literal object that contains the data to send</param>
 public UDPDataInfo SendToServer(string channelName, object udpData)
 {
     return(_udpManager.Send(channelName, udpData, _serverAddress, _serverPort));
 }