Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Making networking simple for teachers

Project Description

https://travis-ci.org/tjguk/networkzero.svg?branch=master

Make it easy for learning groups to use simple networking in Python

API

address below refers to an IP:Port string eg “192.0.2.5:4567”

Discovery

  • address = advertise(name, address=None)
  • address = discover(name, wait_for_s=FOREVER)
  • [(name, address), …] = discover_all()
  • [(name, address), …] = discover_group(group_name, separator=”/”)

Messaging

  • reply = send_message_to(address, message, wait_for_reply_s=FOREVER)
  • message = wait_for_message_from(address, [wait_for_s=FOREVER])
  • send_reply_to(address, reply)
  • send_news_to(address, news)
  • wait_for_news_from(address[, pattern=EVERYTHING][, wait_for_s=FOREVER])

Typical Usage

On computer (or process) A:

import networkzero as nw0

address = nw0.advertise("hello")
while True:
    name = nw0.wait_for_message_from(address)
    nw0.send_reply_to(address, "Hello, %s" % name)

On computer (or process) B and C and D…:

import networkzero as nw0

server = nw0.discover("hello")
reply = nw0.send_message_to(server, "World")
print(reply)
reply = nw0.send_message_to(server, "Tim")
print(reply)

Release history Release notifications

This version
History Node

1.0b1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
networkzero-1.0b1-py2.py3-none-any.whl (20.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3 May 20, 2016
networkzero-1.0b1.zip (22.1 kB) Copy SHA256 hash SHA256 Source None May 20, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page