• Stars
    star
    132
  • Rank 272,952 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple automatic (local) network discovery in C#

Beacon: automatic network discovery

Beacon is a small C# library that helps remove some of the user annoyances involved in writing client-server applications: finding the address of the server to connect to (because messing around putting in IP addresses is so much fun, eh?)

In that sense, it fills the same niche as other tools like Apple's Bonjour, but with minimal dependencies.

How it works

UDP broadcasts, what else did you expect? :) It doesn't work outside your own network range without an external server (support for something like this could be added...!) but inside one network it works quite well.

The current Beacon implementation has support for local advertising based on application type (so different programs both using Beacon don't interfere with each other), and advertising server-specific data, which can be used to distinguish different servers from each other (for example, by presenting a display name to the user).

Starting a Beacon server

Starting a beacon (to make a server discoverable) is simple:

var beacon = new Beacon("myApp", 1234);
beacon.BeaconData = "My Application Server on " + Dns.GetHostName();
beacon.Start();

// ...

beacon.Stop();

1234 is the port number that you want to advertise to clients. Typically, this is the port clients should connect to for your actual network service. You can fill in a bogus value if you don't need it.

Scanning for servers using a Probe

Clients can find beacons using a Probe:

var probe = new Probe("myApp");
// Event is raised on separate thread so need synchronization
probe.BeaconsUpdated += beacons => Dispatcher.BeginInvoke((Action)(() => {
    for (var beacon in beacons)
    {
        Console.WriteLine(beacon.Address + ": " + beacon.Data);
    }        
}));

probe.Start();

// ...

probe.Stop();

A WPF dialog is included that you can present to users to let them pick a server.

Help wanted

This repository currently contains a simple C# implementation of the Beacon protocol. Implementations in other languages and for other platforms (Android, iOS, C++) are very welcome, as well as improvements to the protocol.

More Repositories

1

WindowsPathEditor

PATH editor for people who use a lot of "unixy" tools on Windows
C#
280
star
2

gcl

Generic Configuration Language (A reusable configuration language for Python)
Python
58
star
3

cover2cover

Convert JaCoCo coverage reports to Cobertura coverage reports
Python
55
star
4

cdk-ecs-demo

Sample code for an ECS application definition using CDK
TypeScript
41
star
5

sailor

A curses widget toolkit for Python
Python
24
star
6

ios-power-geniustools

Power usage analysis tools for iOS, similar to the ones available at the Genius Bar
Python
24
star
7

libbruce

B-tree library for use with remote storage (DynamoDB, S3) in C++
C++
23
star
8

cdk-github-queries

A simple Chrome app to keep track of common GitHub queries
JavaScript
9
star
9

devoops-sample

TypeScript
7
star
10

cfngine

An implementation of CloudFormation templates
TypeScript
6
star
11

metawordle

Solving Wordle by observing the colored squares people post on Twitter | https://twitter.com/metawordle
Python
6
star
12

patchouli

A utility for interactively splitting up patch files
Python
3
star
13

cookiecutter-cdk-package

A CookieCutter template for a fresh CDK package
TypeScript
3
star
14

sketch-recognition-workshop

Base code for the sketch recognition workshop
C++
3
star
15

fifinet

A tiny graph database and query engine
TypeScript
2
star
16

partypictures

Send event pictures from a mobile phone to a large display
C#
2
star
17

SWoCAndroid

Find the picture
Java
2
star
18

game-of-life-lambda-calculus

The Game of Life, implemented in the Lambda Calculus (in JavaScript)
JavaScript
2
star
19

SiouxTube

Simple viewer to get YouTube videos sent by mail up onto a large screen
C#
2
star
20

serve-npm-tarballs

A teensy little utility to serve NPM tarballs for testing purposes.
JavaScript
2
star
21

vim-gcl

Vim syntax definitions for GCL language
Vim Script
2
star
22

kessel-run

Start a gaming rig in the cloud in a couple of minutes
TypeScript
2
star
23

flappy.ps

Flappy Bird in PostScript
PostScript
1
star
24

st-build

An experiment in building a software system in Lambda
TypeScript
1
star
25

rix0rrr.github.com

Shell
1
star
26

jsii-test-drive

Java
1
star
27

refinetree

Hierarchical drilldown menu for JavaScript (jQuery, Bootstrap)
JavaScript
1
star
28

RC-5-Remote-Control-Codes

A simple C++ implementation of a transmitter and receiver for the Philips RC-5 Remote Control codes
C#
1
star
29

cdk-github-md2pdf

CDK Application using Lambda Webhooks to convert MarkDown docs to PDF in a GitHub repo
TeX
1
star
30

mallocviz

Memory use visualization for compiled applications
JavaScript
1
star
31

nozem

A very particular build tool for a very specific situation
TypeScript
1
star
32

imergenary-friend

A friendly GitHub merge bot, slightly different from all the other ones out there.
TypeScript
1
star
33

simple-network-simulator

Simulator of clients making server requests to help me understand backoff behaviour
JavaScript
1
star