Categorias: Todos - client - connection - events

por Annachiara Gargiulo 2 anos atrás

107

MAIN

The process described involves managing socket connections and handling input/output events. Initially, a socket is bound to a host and port, then it listens for incoming connections.

MAIN

while !keyboard interrupt

Unblock Socket

Selector registers the socket

Select events ready for I/O
Events [KEY, MASK]

FOR KEY, MASK , IF KEY.DATA IS EMPTY

(YES) accept new connection

ACCEPT_WRAPPER(KEY.FILEOBJ)

(NO) Serve the client

SERVICE_CONNECTION(KEY, MASK)

Service Connection

Accept Wrapper

Start Socket

BIND(); LISTEN()

Add text

Summary

MAIN

Default selector

Host,port