Categorías: Todo - client - connection - events

por Annachiara Gargiulo hace 2 años

105

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