| ryah ( @ 2009-05-02 18:12:00 |
| Entry tags: | programming |
TCP
I think the proper abstraction of a TCP socket (both sides) is something like this
events:
- connected
- received data
- send buffer drained
- got FIN
- done
methods:
- connect (for clients only)
- send
- close (sends FIN, shutdown(fd, SHUT_WR))
this is rather tricky to get right. (posix's unholy mixture of sockets and files aids to the confusion.) am i missing anything?