Esempio n. 1
0
        async Task <(ISendAsyncContext <INngMsg>, IReceiveAsyncContext <INngMsg>)> CreatePusherAndPuller()
        {
            var url        = UrlIpc();
            var pushSocket = factory.PusherOpen().Unwrap();

            pushSocket.Listen(url).Unwrap();
            var push = pushSocket.CreateAsyncContext(factory).Unwrap();

            await WaitReady();

            var pullSocket = factory.PullerOpen().Unwrap();

            pullSocket.Dial(url).Unwrap();
            var pull = pullSocket.CreateAsyncContext(factory).Unwrap();

            return(push, pull);
        }
Esempio n. 2
0
 /// <summary>
 /// Create push node for push/pull protocol
 /// </summary>
 /// <returns>The create.</returns>
 /// <param name="factory">Factory.</param>
 /// <param name="url">URL.</param>
 /// <param name="isListener">If set to <c>true</c> is listener.</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public static NngResult <IPushSocket> PusherCreate <T>(this IAPIFactory <T> factory, string url, bool isListener) => factory.DialOrListen(factory.PusherOpen(), url, isListener);