If we want the application and the TCP/IP-stack to acct on their state autonomously, we need a message interface between them that does not only transfer 'payload' i.e. user requests and answers. Applications will typically interact with the sockets. They may for instance:
request socket state before sending something
open new sockets upon requests
close sockets after answering or timeout
This means, we do not only need a buffer structure like Map<SocketHandle, Vec<Message>>, we also need to implement a 'message API' at the interface that takes 'commands' from the application to open, close, connect etc. sockets.
If we want the application and the TCP/IP-stack to acct on their state autonomously, we need a message interface between them that does not only transfer 'payload' i.e. user requests and answers. Applications will typically interact with the sockets. They may for instance:
request socket state before sending something
open new sockets upon requests
close sockets after answering or timeout
This means, we do not only need a buffer structure like
Map<SocketHandle, Vec<Message>>
, we also need to implement a 'message API' at the interface that takes 'commands' from the application to open, close, connect etc. sockets.