In the Lua Nginx module docs about ngx.socket.tcp() (Link), it says:
Creates and returns a TCP or stream-oriented Unix domain socket object (also known as one type of the "cosocket" objects)
This TCP socket can be used to connect to remote host, but in the wiki about unix domain socket (Link):
A Unix domain socket or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system
This leads me to some questions:
- Is this TCP socket another type of Unix domain socket? What is this TCP socket really be?
- What is cosocket referred in the docs? I can't find it using google
- TCP protocol is also used in the transport layer of the TCP/IP model, is this API allow to program directly in the transport layer, bypassing the application layer?