How to use TFO in AnyEvent::Socket?

Marc Lehmann schmorp at
Mon Feb 13 12:26:29 CET 2017

On Mon, Feb 13, 2017 at 12:15:19PM +0800, Li Zhou <zhou384 at> wrote:
> MSG_FASTOPEN and TCP_FASTOPEN are defined since socket 2.021 .
> Is there an easy way to enable TCP Fast Open the AnyEvent way?

AnyEvent::Socket operates on normal perl filehandles, so anything that works
for perl sockets works for AnyEvent::Socket sockets - they are the same.

> Does the push_write() function automatically handle this if MSG_FASTOPEN is
> set on the client socket?

That's from AnyEvent::Handle, and AFAICS, MSG_FASTOPEN is a send(to) flag, so it
cannot be set on the client socket in a meaningful way, therefore it should
be fully supported with AnyEvent::Handle.

TCP_FASTOPEN is for listen sockets, and again, AFAICS, since no code change
is necessary, it should be fully supported by AnyEvent::Handle.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the anyevent mailing list