Protocol

A protocol describes the steps of exchanging information. This is usually done by a finite state machine. Our protocol is simple, so we just proceed using a less formal line diagram.

time

step

server

client

1

c.1

 

client connects to server by opening a socket

2

s.1

server sends the server ready signal, by writing the character ! on the socket

 

3

c.2

 

client reads the ! character, so it knows that the server is ready

4

c.3

 

client sends the request (see below how)

5

s.2

server reads the request

 

6

s.3

server performs the request

 

7

s.4

server transmits a status code to the client (see below how)

 

8

c.4

 

client reads the status code and reports it

8

c.4

 

client says good bye, by writing a single ! character on the socket and then closes it

9

c.5

server reads the good bye and closes the socket

 



This is a very simple protocol, no recovery, retransmission and other complications.

e.g. !sam/login!

0: success

1: logevent unknown

2: transmission error (the request could not be parsed)

3: database error

4: any other error that prohibited the server to fulfill the request

So, if all went well, the server would write !0! and if the log event was unknown, it would write !1!. If more than one error occurred, only one has to be reported.