예제 #1
0
        /// <summary>
        /// Listen for incoming connection requests on a particular Socket ID, or optionally all Socket IDs. The bound function
        /// will only be called if the connection has not already been accepted.
        /// </summary>
        /// <param name="options">Information about who would like notifications, and (optionally) only for a specific socket</param>
        /// <param name="clientData">This value is returned to the caller when ConnectionRequestHandler is invoked</param>
        /// <param name="connectionRequestHandler">The callback to be fired when we receive a connection request</param>
        /// <returns>
        /// A valid notification ID if successfully bound, or <see cref="Common.InvalidNotificationid" /> otherwise
        /// </returns>
        public ulong AddNotifyPeerConnectionRequest(AddNotifyPeerConnectionRequestOptions options, object clientData, OnIncomingConnectionRequestCallback connectionRequestHandler)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <AddNotifyPeerConnectionRequestOptionsInternal, AddNotifyPeerConnectionRequestOptions>(ref optionsAddress, options);

            var clientDataAddress = System.IntPtr.Zero;

            var connectionRequestHandlerInternal = new OnIncomingConnectionRequestCallbackInternal(OnIncomingConnectionRequestCallbackInternalImplementation);

            Helper.AddCallback(ref clientDataAddress, clientData, connectionRequestHandler, connectionRequestHandlerInternal);

            var funcResult = EOS_P2P_AddNotifyPeerConnectionRequest(InnerHandle, optionsAddress, clientDataAddress, connectionRequestHandlerInternal);

            Helper.TryMarshalDispose(ref optionsAddress);

            Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);

            return(funcResult);
        }
예제 #2
0
        /// <summary>
        /// Listen for incoming connection requests on a particular Socket ID, or optionally all Socket IDs. The bound function
        /// will only be called if the connection has not already been accepted.
        /// </summary>
        /// <param name="options">Information about who would like notifications, and (optionally) only for a specific socket</param>
        /// <param name="clientData">This value is returned to the caller when ConnectionRequestHandler is invoked</param>
        /// <param name="connectionRequestHandler">The callback to be fired when we receive a connection request</param>
        /// <returns>
        /// A valid notification ID if successfully bound, or <see cref="Common.InvalidNotificationid" /> otherwise
        /// </returns>
        public ulong AddNotifyPeerConnectionRequest(AddNotifyPeerConnectionRequestOptions options, object clientData, OnIncomingConnectionRequestCallback connectionRequestHandler)
        {
            var optionsInternal = Helper.CopyProperties <AddNotifyPeerConnectionRequestOptionsInternal>(options);

            var connectionRequestHandlerInternal = new OnIncomingConnectionRequestCallbackInternal(OnIncomingConnectionRequest);
            var clientDataAddress = IntPtr.Zero;

            Helper.AddCallback(ref clientDataAddress, clientData, connectionRequestHandler, connectionRequestHandlerInternal);

            var funcResult = EOS_P2P_AddNotifyPeerConnectionRequest(InnerHandle, ref optionsInternal, clientDataAddress, connectionRequestHandlerInternal);

            Helper.TryMarshalDispose(ref optionsInternal);

            Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);

            var funcResultReturn = Helper.GetDefault <ulong>();

            Helper.TryMarshalGet(funcResult, out funcResultReturn);
            return(funcResultReturn);
        }
예제 #3
0
 internal static extern ulong EOS_P2P_AddNotifyPeerConnectionRequest(System.IntPtr handle, System.IntPtr options, System.IntPtr clientData, OnIncomingConnectionRequestCallbackInternal connectionRequestHandler);
예제 #4
0
 private static extern ulong EOS_P2P_AddNotifyPeerConnectionRequest(IntPtr handle, ref AddNotifyPeerConnectionRequestOptionsInternal options, IntPtr clientData, OnIncomingConnectionRequestCallbackInternal connectionRequestHandler);