Re: RE : [sysapps/raw socket api]: List of changes to be done based on Madrid session 2013-04-09

On Apr 10, 2013 9:02 PM, "Ke-Fong Lin" <ke-fong.lin@4d.com> wrote:
>
> Hi Claes,
>
> Just a few comments:
>
> >o   Add method upgradeToSSL() and event when done
> >(Claes comment: TLS could be used so maybe we should call the method
upgradeToSecureTransport()? In addition, do we need this for UDP as well?)
>
> Yes, that's probably better naming.
> You'll have to add constructors with provision for certificate of server
to connect to.
> As for UDP, there is no widely used standard for secured communication
and no SSL/TLS equivalent.
>
> >o   Add method halfClose() and event when done.
> >(Claes comment: We might need additional states in “readyState”,
“halfclosing” and “halfclosed”?)
>
> 1) This will add 2 more states and break possible "compatibility" with
WebSocket.
>
> 2) I'll need to double check that, but I don't think there is a need for
an "halfClosing" state. To indicate "half closing" (I won't send further
data but just listen), a "FIN" packet has to be sent. This is of course not
instantaneous. Yet, Berkeley socket implements that using the shutdown()
function, which can even tell the OS that a particular socket won't receive
any data anymore. For that, there is no TCP protocol related associated
action, it's just the OS preventing you to read. As for write, it (the OS)
prevents (with immediate action) data to be written and does sends the FIN
packet to the peer. So you basically just go to the "halfClosed" state
immediately, even if the peer may not know it yet.

If calling halfClose means that the code can't send any more messages we
definitely need to have a way for the code to detect that state. For
example so that it can implement a connection pool which creates new
connections as needed.

We won't be 100% compatible with WebSocket anyway so I don't think its a
big deal if there's another state here.

/ Jonas

Received on Thursday, 11 April 2013 07:24:22 UTC