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 ¶
const NetError = "NetError"
NetError is the kind of the exceptions for network problems.
Variables ¶
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.