public static void SetTestOptions(INngSocket socket, int timeoutMs = Util.ShortTestMs) { socket.SetOpt(nng.Native.Defines.NNG_OPT_RECVTIMEO, new nng_duration { TimeMs = timeoutMs }); socket.SetOpt(nng.Native.Defines.NNG_OPT_SENDTIMEO, new nng_duration { TimeMs = timeoutMs }); }
public static NngResult <INngCtx> Create(INngSocket socket) { var res = nng_ctx_open(out var ctx, socket.NativeNngStruct); if (res != 0) { return(NngResult <INngCtx> .Fail(res)); } return(NngResult <INngCtx> .Ok(new NngCtx { NativeNngStruct = ctx })); }
public static INngDialer Create(INngSocket socket, string url) { int res = nng_dialer_create(out var dialer, socket.NativeNngStruct, url); if (res != 0) { return(null); } return(new NngDialer { NativeNngStruct = dialer }); }
public static bool IsValid(this INngSocket self) { return(self.Id != -1); }
public NngResult <INngCtx> CreateCtx(INngSocket socket) => NngCtx.Create(socket);