The Snarl Network Protocol (SNP) provides simple access to both local and remote instances of Snarl. It is TCP-based and thus the sending computer need not be running Snarl (or Windows) - so long as it can connect via TCP/IP to a remote computer running Snarl, it will be able to send notifications.
Note: Support for SNP 1.0 is now deprecated and applications are encouraged to use the current version of the protocol - SNP 3.0.
Communication takes place using TCP via port 9887. Typically it is down to the client to manage the connection and terminate it when no further communication is required, however in some cases Snarl may terminate the connection (due to malformed messages, security concerns, etc.).
The communication process is as follows:
Callback events and notifications forwarded as the result of a subscription will also be received by the client.
The client may choose to create a new socket for each request, or re-use an existing socket. If the client is expecting to handle callbacks then it should ensure the socket remains open at least until the callback is received. If a client has subscribed for notifications from a remote computer, it must leave the socket open in order to receive notifications sent by the remote computer.
An SNP 2.0 request follows this pattern:
Note the following:
An SNP 2.0 response follows this pattern: