class SOCKET_SERVER_JOB

Features exported to JOB

Encapsulate the server in a sequencer-aware job.

Direct parents

conformant parents

JOB

Summary

creation features

exported features

Details

make (a_server: SOCKET_SERVER)
when_connect (handler: PROCEDURE [O_ -> TUPLE][TUPLE 1 [A_][SOCKET_INPUT_OUTPUT_STREAM]])

What to do when connection happens (i.e. some client tries to connect to the server). The procedure is given the stream connected to the client.

require

  • not done

when_shutdown (handler: PROCEDURE [O_ -> TUPLE][TUPLE 1 [A_][SOCKET_SERVER_JOB]])

Should be more accurately be called when_shutdown_or_halt. The agent is called when a shutdown or a halt of the server occurs.

require

  • not done

shutdown

Wait for the connections to finish, then stop the server. No more connections will be accepted.

require

  • not done

ensure

  • done

halt

require

  • not done

ensure

  • done

done: BOOLEAN

done returns True when the job is finished. Then the job may be restart(ed) if it need to run again.

priority: INTEGER

Never change priority after job inserted in loop_item. Priority should only be set at creation time.

Class invariant