part4

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: 7 Imported by: 0

Documentation

Overview

This program is a combination of parts 2 and 3.

It listens on the host and port specified by the -listen flag. For each incoming connection, it launches a goroutine that reads and decodes JSON-encoded messages from the connection and prints them to standard output. It concurrently makes a connection to the host and port specified by the -dial flag, reads lines from standard input, and writes JSON-encoded messages to the network connection.

You can test it by running part3 in one terminal:

$ part3 -listen=localhost:8000

Running this program in another terminal:

$ part4 -listen=localhost:8001 -dial=localhost:8000

And running part2 in another terminal:

$ part2 -dial=localhost:8001

Lines typed in the second terminal should appear as JSON objects in the first terminal, and those typed at the third terminal should appear in the second.

Jump to

Keyboard shortcuts

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