Receiving callbacks on a different port - fullphat/snarl_network_protocol GitHub Wiki
SNP 3.1 introduces the ability to receive callbacks and other out-of-cycle messages on a different TCP port. This allows the client to run a tight request/reply loop and process incoming asynchronous messages as they arrive.
Here's a quick demonstration of how to see this in effect:
- Open in a new Command Prompt and start Netcat listening on port 5000 (you can download a version of Netcat for Windows here) by entering the following:
> **nc -L -p 5000**
- In a new Command Prompt window, send a notification with the
reply-port
property set to5000
. You can use SnpSend to do this as follows:
> **snpsend localhost 8521 -N -t "Hello, world!" -r 5000**
- Wait for the notification to expire, or dismiss it manually. Note the message that appears in the Netcat window:
SNP/3.1 CALLBACK
callback-number: 303
callback-type: NotificationExpired
uid:
x-callback-timestamp: Mon, 02 Apr 2018 21:35:07 GMT
END