Plan B User's Manual


Name

con, tcp, udp ­ Network connection boxes

Synopsis

/b/con
/b/tcp
/b/udp

Description

Boxes under /b/proto represent network connection end-points implemented by the proto protocol. Even datagram based services are represented by connection end-point boxes. The prefix /b/con is used to import different network protocols under the same set of names.

Applications can use make(2) to create new end-points. A make under /b/tcp creates a TCP end-point; the same happens under /b/udp for UDP end-points. Applications that do not care of the particular protocol used are expected to make new end-points under /b/con. In what follows, all names refer to boxes under these prefixes.

Plan B connection boxes are intended to be used under a client-server model. A client is an application that creates an end-point to send data to a server. A server is an application that creates an end-point to receive data from a client. Clients create boxes named machine:port and then copy data to them. A copy(2) to machine:port sends data to that port at that machine. The connection is established on demand (when copying). If it breaks, Plan B tries to reconnect on demand. Servers create boxes named local.N:port to listen at port for new connection requests, and then copy data from them. There is no connection acceptance/refusal mechanism, the system accepts all requests. To simultaneously listen for different requests at port, a server can create multiple local.N:port boxes (with different values for N).

On connection-oriented protocols, a local.N box can be used to send data back to the client by copying data into it.

On protocols supporting broadcast the application can create boxes named any:port to perform a broadcast targetted to port.

Since the interface does not provide all the set of operations available for the protocols implemented, there can be boxes named raw.N:0 providing raw access to the protocol stack. When using these boxes the application is responsible for supplying appropriate headers in addition to user data. Special operations such like accepting/refussing connections are done by copying fake headers into/out of the end-point.

Announces

/b/tcp as /con.

Source

/src/b/*/conbox.c

Bugs

There is no raw box implemented, since no application requires it yet.

Automatic reconnection should raise an error after N unsucessful attempts.



Plan B User's Manual. First edition.