libSnp - fullphat/snarl_network_protocol GitHub Wiki

A drop-in Snarl Network Protocol library for .net applications.

Installing

You can download the latest version here. After that, it's simply a case of referencing the dll in your .net application.

Usage

SNP requests are encapsulated in the SNP31Request class. However, you don't create a new SNP31Request; you simply ask for a specific pre-populated request from the SNP31 class. Once you have your request, you can issue it, or you can customise certain aspects of it:

SNP31Request registerMsg = SNP31.RegisterRequest("bar.foo", "s3cr3t", "Foo.Bar", "myicon.png");

A SNP request is issued by calling the SNP31Request SendTo() method. This returns a SNP31Response that indicates whether the request was sent successfully or not. If the request failed, you can find out why by interrogating the StatusCode and Reason properties. You're free to send the same request multiple times.

SNP31Response registerReply = registerMsg.SendTo(host, port);

The code above can even be condensed into a single line:

SNP31Response registerReply = SNP31.RegisterRequest("bar.foo", "s3cr3t", "Foo.Bar", "myicon.png").SendTo(host, port);

Objects

Protocols Supported

Currently only SNP 3.1 is supported. Other protocols may be added over time.

Examples

This repository contains a number of libSnp examples, Chat-o-licious! and CommandLineSender being two.