public Udp(Loop loop) : base(loop, HandleType.UV_UDP) { int r = uv_udp_init(loop.NativeHandle, NativeHandle); Ensure.Success(r, loop); // we can't supply just recv_start_callback in Receive // because it will create a temporary delegate which could(and will) be garbage collected at any time // happens in my case after 10 or 20 calls // so we have to reference it, so it won't garbage collect it until the object itself // is gone recv_start_cb_win = recv_start_callback_w; recv_start_cb_unix = recv_start_callback_u; }
public Udp(Loop loop) : base(loop, UvHandleType.UV_UDP) { int r = uv_udp_init(loop.Handle, handle); Ensure.Success(r, loop); // we can't supply just recv_start_callback in Receive // because it will create a temporary delegate which could(and will) be garbage collected at any time // happens in my case after 10 or 20 calls // so we have to reference it, so it won't garbage collect it until the object itself // is gone recv_start_cb_win = recv_start_callback_w; recv_start_cb_unix = recv_start_callback_u; }
extern static int uv_udp_recv_start_win(IntPtr handle, alloc_callback_win alloc_callback, recv_start_callback_win callback);
internal static extern int uv_udp_recv_start_win(IntPtr handle, alloc_callback_win alloc_callback, recv_start_callback_win callback);