state - How can I know if the client has closed the connection? -
i checked stream3.c
example , found when closed page in browser, servlet, i.e. stream3.c
, still running 2 rounds terminated.
that means, data of last 2 rounds lost.
who can explain how confirm connection status before sending data?
obviously, gwan knows connection status, otherwise not terminate stream3.c
, gwan may not know in real time.
if there no way know in real time, important data cannot sent without double checking through way.
how confirm connection status before sending data?
the reliable way try sending data client socket. if connection has been closed call fail.
if socket has been recycled (re-used new connection) session_id
(and possily client ip address) different.
if connection "cleanly" closed (if client used shutdown()
, waited bit before closing) g-wan know status of connection before servlet, otherwise, g-wan know when sending reply (or after read/write timeout).
to kind of cases described question, new state called before_close
has been added few weeks ago working on websockets.
Comments
Post a Comment