lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It was thus said that the Great Francisco Olarte once stated:
> Jeonghum:
> On Tue, Mar 31, 2020 at 3:41 AM Jeonghum Joh <> wrote:
> > I am investigating UDP Unix Domain Socket APIs in luasocket.
> ...
> > Diego Nehab provided TCP Unix Domain Socket sample code and I tested it successfully. I appreciate him for this email.
> Unix domain sockets do not support UDP or TCP, they support Datagram
> or Stream sockets. UDP and TCP are the datagram sockets for IP. Also,
> on some places, unix domain sockets support sequence datagram ( which
> is a mix, message oriented but reliable and ordered ) ( man 7 unix
> could help ).
> That being said, I'm not a luasocket, but this intrigued me, I had a
> look at the source and it seems it just opens them in SOCK_STREAM
> mode. Add to this the existence of different C source files for tcp
> and udp ( and unix ) and it seems you just have SOCK_STREAM and
> SOCK_DGRAM in AF_INET ( tcp and udp ) and SOCK_STREAM in AF_UNIX (
> byte stream unix sockets ).

  To clarify things a bit [1], you create either a SOCK_STREAM or SOCK_DGRAM
[2], then bind it to an address.  The address can either be a Unix domain,
in the IP domain (IPv4) or IPv6 domain.  It maps out as:

	Unix	stream		datagram

  You can have Unix domain sockets with datagrams.  How you create these in
luasocket I don't know as I don't use it, but it should be possible.


[1]	I don't use luasocket, but my own module:

[2]	There are other types but they're not important right now.