part05

command
v0.0.0-...-3215db2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

This program extends part 4.

It listens on an available public IP and port, and for each incoming connection it decodes JSON-encoded messages and writes them to standard output. It simultaneously makes a connection to the host and port specified by -peer, reads lines from standard input, and writes JSON-encoded messages to the network connection. The messages include the listen address. For example:

{"Addr": "127.0.0.1:41232", "Body": "Hello"!}

You can test this program by listening with the dump program:

$ dump -listen=localhost:8000

In another terminal, running this program:

$ part5 -peer=localhost:8000

And in a third terminal, running part2 with the address printed by part5:

$ part2 -dial=192.168.1.200:54312

Lines typed in the third terminal should appear in the second, and those typed in the second window should appear in the first.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL