On Thu, Jan 31, 2019 at 05:43:42PM +0100, Catonano wrote: > Hello > > in Fibers there's an example of a client connecting to a server > > I'd like to do the same thing BUT in my case the server provides a unix > socket. > > It's a unix socket provided by Postgresql. On Ubuntu it's here > /var/run/postgresql/.s.PGSQL.5432 > > I'm wondering about these 3 lines the fibers client uses > > ;; Disable Nagle's algorithm. We buffer ourselves. > (setsockopt port IPPROTO_TCP TCP_NODELAY 1)
The one above probably doesn't make sense for Unix domain sockets (it is specific to IP sockets and it is meant to delay sending a small packet in the hope that more stuff arrives, to avoid lots of tiny packets) > (fcntl port F_SETFL (logior O_NONBLOCK (fcntl port F_GETFL))) while this one does make sense (as Chris notes): you want your other fibres to do their happy dancing instead of blocking the whole process in the read. > (setvbuf port 'block 1024) > > Can a unix socket be non blocking ? Yes, they can be both. In this respect they are not different from IP sockets. Cheers -- t
signature.asc
Description: Digital signature
