Skip to content

Latest commit

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Server-wrapper

Protocol

A client-to-server message is structured as follows.

 __________________________________________________________
| | | | | |
| type | name_length | name | payload_length | payload |
| (1 byte) | (4 bytes) | | (4 bytes) | |
|__________|_____________|______|________________|_________|

A server-to-client message is structured as follows.

 _____________________________________
| | | |
| type | payload_length | payload |
| (1 byte) | (4 bytes) | |
|__________|________________|_________|

These are the messages:

typedescriptiondirection
00Alive?c -> s
08ACKs -> c
09NACKs -> c
10Regular parameterc -> s
20Input file parameterc -> s
30Output file parameterc -> s
40Run requestc -> s
50Get outputc -> s
59Outputs -> c

Use-case scenario

Preliminaries

  • Start server on port 9001 only allowing for 1 concurrent run request that executes the command /ufs/elkebir/src/heinz/build/heinz.

     ./server.py 9001 1 /ufs/elkebir/src/heinz/build/heinz
    
  • Start client that connects to localhost via port 9001.

     ./testclient localhost 9001
    

Client-server session

  1. Do a ping.

     > 0
    8
    

The server responds with ACK (8).

  1. Send over regular parameter -p.

     > 10 -p
    8
    

The server responds with ACK (8).

  1. Send over regular parameter -t 5.

     > 10 -t 5
    8
    

The server responds with ACK (8).

  1. Send over input file parameter -n <FILE>.

     > 20 -n /ufs/elkebir/src/NINA/data/MWCS/test/nodes-from-russia.txt
    8
    

    The server responds with ACK (8) and generated a new file in the specified /tmp directory. The contents of this file correspond to nodes-from-russia.txt.

  2. Send over input file parameter -e <FILE>.

     > 20 -e /ufs/elkebir/src/NINA/data/MWCS/test/edges-from-russia.txt
    8
    

    The server responds with ACK (8) and generated a new file in the specified /tmp directory. The contents of this file correspond to edges-from-russia.txt.

  3. Send over output file parameter -o.

     > 30 -o
    8
    

    The server responds with ACK (8) and generated a new parameter -o <NEW_OUT_FILE> where <NEW_OUT_FILE> is a new unique file name.

  4. Tell the server to run the executable.

     > 40
    8
    

Upon completion, the server responds with ACK (8).

  1. Obtain stderr.

     > 50 255
    59 ...
    

The server responds with message 59 containing stderr.

  1. Obtain stdout.

     > 50 254
    59 ...
    

The server responds with message 59 containing stdout.

  1. Obtain first output file (numbered 0).

    > 50 0
    59 ...
    

The server responds with message 59 containing the output.

  1. Obtain second output file (numbered 1).

    50 1 9

Since we did not specify a second output file parameter, the server responds with NACK (9).

  1. Close the connection.

    > x
    

The server will remove all generated files.

About

Socket-based server wrapper

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages