Esempio n. 1
0
        /// <summary>
        /// Send a packet to a peer at the specified address. If there is already an open connection to this peer, it will be
        /// sent immediately. If there is no open connection, an attempt to connect to the peer will be made. An <see cref="Result.Success" />
        /// result only means the data was accepted to be sent, not that it has been successfully delivered to the peer.
        /// </summary>
        /// <param name="options">Information about the data being sent, by who, to who</param>
        /// <returns>
        /// <see cref="Result" />::<see cref="Result.Success" /> - If packet was queued to be sent successfully
        /// <see cref="Result" />::<see cref="Result.InvalidParameters" /> - If input was invalid
        /// <see cref="Result" />::<see cref="Result.LimitExceeded" /> - If amount of data being sent is too large
        /// </returns>
        public Result SendPacket(SendPacketOptions options)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <SendPacketOptionsInternal, SendPacketOptions>(ref optionsAddress, options);

            var funcResult = EOS_P2P_SendPacket(InnerHandle, optionsAddress);

            Helper.TryMarshalDispose(ref optionsAddress);

            return(funcResult);
        }
Esempio n. 2
0
 public void Set(SendPacketOptions other)
 {
     if (other != null)
     {
         m_ApiVersion         = P2PInterface.SendpacketApiLatest;
         LocalUserId          = other.LocalUserId;
         RemoteUserId         = other.RemoteUserId;
         SocketId             = other.SocketId;
         Channel              = other.Channel;
         Data                 = other.Data;
         AllowDelayedDelivery = other.AllowDelayedDelivery;
         Reliability          = other.Reliability;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 短縮 SendPacket
        /// </summary>
        /// <param name="p2p">P2PInterface</param>
        /// <param name="socketName">ソケット名</param>
        /// <param name="remoteUserId">送信先ユーザーID</param>
        /// <param name="localUserId">ログインユーザーID</param>
        /// <param name="channel">チャンネル</param>
        /// <param name="data">データ</param>
        public static void SendPacket(this P2PInterface p2p, string socketName, ProductUserId remoteUserId, ProductUserId localUserId, byte channel, byte[] data)
        {
            var op = new SendPacketOptions
            {
                SocketId = new SocketId
                {
                    SocketName = socketName
                },
                RemoteUserId = remoteUserId,
                LocalUserId  = localUserId,
                Channel      = channel,
                Data         = data
            };
            var result = p2p.SendPacket(op);

            if (result != Result.Success)
            {
                Debug.LogError($"error {DebugTools.GetClassMethodName()}:{result}");
            }
        }