netmod

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package netmod is the native module "net": TCP connections (and connections over Unix sockets) and UDP packets (TODO.md Q103).

use net;
local c = net::connect("tcp://example.com:80", 5);
c->write("HEAD / HTTP/1.0\r\nHost: example.com\r\n\r\n");
println(c->readline());
c->close();

Addresses are "tcp://host:port", "unix:///path" and "udp://host:port", as for zmq and p9. Data is strings (bytes). Calls that wait (connect, accept, read, write, receive) can be cancelled by the Go program that runs the interpreter; ondata, onconnect and onmessage hand what comes to the event loop (events) instead. What a program leaves open is closed when it ends (VM.End).

Index

Constants

View Source
const NetError = "NetError"

NetError is the kind of the exceptions for network problems.

Variables

View Source
var (
	Conn     = &native.Class{Name: "Conn"}
	Listener = &native.Class{Name: "Listener"}
	UDP      = &native.Class{Name: "UDP"}
)

The classes of the module. None has a constructor: objects come from net::connect, net::listen and net::udp.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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