Warning: include() [function.include]: URL file-access is disabled in the server configuration in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 2

Warning: include(http://www.smowton.f2s.com/chrissite/header.htm) [function.include]: failed to open stream: no suitable wrapper could be found in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 2

Warning: include() [function.include]: Failed opening 'http://www.smowton.f2s.com/chrissite/header.htm' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 2

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 3

Warning: include(http://www.smowton.f2s.com/chrissite/menu.htm) [function.include]: failed to open stream: no suitable wrapper could be found in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 3

Warning: include() [function.include]: Failed opening 'http://www.smowton.f2s.com/chrissite/menu.htm' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /websites/LinuxPackage04/sm/ow/to/smowton.f2s.com/public_html/chrissite/ppmserve/protocol.php on line 3

PPMServe Protocol

All integers are sent in big-endian format.

Connection init

The client starts the connection (to port 2111 at present) and speaks first. The client should send a 4-byte integer informing the server of the size of the alphabet it wished to work in. The limit is hard and cannot be changed during a session; if the alphabet size changes, a new connection should be established.

Client requests

All requests begin with a single byte opcode followed by a 4-byte integer referencing a working context.

The opcodes and following payloads are as follows:

0: Clone context. The payload is a 4-byte integer referencing the OLD context; the number given as the context ID will be associated with the NEW context (so the overall message is 0{new context}{old context}

1: Create empty context. There is no payload; an empty context will be initialised to be referred to by the specified integer (the 'working context' ID)

2: Enter/learn symbol. The payload consists of a symbol identifier (an arbitrary integer; it does not matter what numbers are used so long as they are used consistently and fall below the range specified during connection init) followed by a 'learn byte'; if zero, the model will enter but not learn the symbol; if non-zero it will learn also.

3: Get probabilities. The payload is an 8-byte normalisation constant (the value to which the probabilities should sum). This is the only message which will cause the server to reply (see below).

4: Release context. Again no payload; the model will simply free a context. Attempts to reference it again after releasing will of course cause an error.

Server replies

The server will only reply when a get probabilities request is sent; all others are accepted silently. If a protocol violation occurs, the server will terminate the connection. After a get probabilities request, it will send a 4-byte integer giving the number of probabilities to send, followed by a series of 8-byte longs, with array index zero coming first.