/// <summary> /// Listen for when a previously opened connection is closed /// </summary> /// <param name="options">Information about who would like notifications about closed connections, and for which socket</param> /// <param name="clientData">This value is returned to the caller when ConnectionClosedHandler is invoked</param> /// <param name="connectionClosedHandler">The callback to be fired when we an open connection has been closed</param> /// <returns> /// A valid notification ID if successfully bound, or <see cref="Common.InvalidNotificationid" /> otherwise /// </returns> public ulong AddNotifyPeerConnectionClosed(AddNotifyPeerConnectionClosedOptions options, object clientData, OnRemoteConnectionClosedCallback connectionClosedHandler) { System.IntPtr optionsAddress = new System.IntPtr(); Helper.TryMarshalSet <AddNotifyPeerConnectionClosedOptionsInternal, AddNotifyPeerConnectionClosedOptions>(ref optionsAddress, options); var clientDataAddress = System.IntPtr.Zero; var connectionClosedHandlerInternal = new OnRemoteConnectionClosedCallbackInternal(OnRemoteConnectionClosedCallbackInternalImplementation); Helper.AddCallback(ref clientDataAddress, clientData, connectionClosedHandler, connectionClosedHandlerInternal); var funcResult = EOS_P2P_AddNotifyPeerConnectionClosed(InnerHandle, optionsAddress, clientDataAddress, connectionClosedHandlerInternal); Helper.TryMarshalDispose(ref optionsAddress); Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult); return(funcResult); }
/// <summary> /// Listen for when a previously opened connection is closed /// </summary> /// <param name="options">Information about who would like notifications about closed connections, and for which socket</param> /// <param name="clientData">This value is returned to the caller when ConnectionClosedHandler is invoked</param> /// <param name="connectionClosedHandler">The callback to be fired when we an open connection has been closed</param> /// <returns> /// A valid notification ID if successfully bound, or <see cref="Common.InvalidNotificationid" /> otherwise /// </returns> public ulong AddNotifyPeerConnectionClosed(AddNotifyPeerConnectionClosedOptions options, object clientData, OnRemoteConnectionClosedCallback connectionClosedHandler) { var optionsInternal = Helper.CopyProperties <AddNotifyPeerConnectionClosedOptionsInternal>(options); var connectionClosedHandlerInternal = new OnRemoteConnectionClosedCallbackInternal(OnRemoteConnectionClosed); var clientDataAddress = IntPtr.Zero; Helper.AddCallback(ref clientDataAddress, clientData, connectionClosedHandler, connectionClosedHandlerInternal); var funcResult = EOS_P2P_AddNotifyPeerConnectionClosed(InnerHandle, ref optionsInternal, clientDataAddress, connectionClosedHandlerInternal); Helper.TryMarshalDispose(ref optionsInternal); Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult); var funcResultReturn = Helper.GetDefault <ulong>(); Helper.TryMarshalGet(funcResult, out funcResultReturn); return(funcResultReturn); }
internal static extern ulong EOS_P2P_AddNotifyPeerConnectionClosed(System.IntPtr handle, System.IntPtr options, System.IntPtr clientData, OnRemoteConnectionClosedCallbackInternal connectionClosedHandler);
private static extern ulong EOS_P2P_AddNotifyPeerConnectionClosed(IntPtr handle, ref AddNotifyPeerConnectionClosedOptionsInternal options, IntPtr clientData, OnRemoteConnectionClosedCallbackInternal connectionClosedHandler);