Skip to main content

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)

Project details


Download files

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

Source Distribution

networkzero-1.0b1.zip (22.1 kB view details)

Uploaded Source

Built Distribution

networkzero-1.0b1-py2.py3-none-any.whl (20.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file networkzero-1.0b1.zip.

File metadata

  • Download URL: networkzero-1.0b1.zip
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for networkzero-1.0b1.zip
Algorithm Hash digest
SHA256 4deefe944e70fd0622bf87c89c5be11eb44f299d53f4c42dd08b9ebba4eb10e1
MD5 456cc314b68d2027704b7f9161b33825
BLAKE2b-256 70ddf12daf38405e9be5b7d7115b2f0f19eaaaecff44871185df2a28017a0f2a

See more details on using hashes here.

File details

Details for the file networkzero-1.0b1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for networkzero-1.0b1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2e75228a687ff690d0e932e0c6c425b65cbb526ca0a73a29db27af4b185e7294
MD5 e48362fcb28661952ce969d0d6f042da
BLAKE2b-256 f3d013da5ca617aea49f5e4296efbf02fb4717d602db587803bbe216fa41f88c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page