[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Does luasocket support unix domain socket UDP?
- From: Sean Conner <sean@...>
- Date: Tue, 31 Mar 2020 03:55:22 -0400
It was thus said that the Great Francisco Olarte once stated:
> On Tue, Mar 31, 2020 at 3:41 AM Jeonghum Joh <email@example.com> 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 , you create either a SOCK_STREAM or SOCK_DGRAM
, 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:
Family SOCK_STREAM SOCK_DGRAM
Unix stream datagram
IP TCP UDP
IPv6 TCP UDP
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.
 I don't use luasocket, but my own module:
 There are other types but they're not important right now.