Категории: Все - client - connection - events

по Annachiara Gargiulo 2 лет назад

120

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