]> jfr.im git - irc/znc/Csocket.git/commit
Add basic support for UNIX sockets
authorUli Schlachter <redacted>
Wed, 8 Feb 2017 16:11:24 +0000 (17:11 +0100)
committerUli Schlachter <redacted>
Wed, 8 Feb 2017 16:11:24 +0000 (17:11 +0100)
commit3355ed21a8d97a83b9a9527edb70c377e7d8725b
tree623d21b88b6a9ff1cce6f2a401eda7742ffef7fa
parent189ee11dde5c865a0423d37fa8da913db1a025ba
Add basic support for UNIX sockets

This adds some basic support for listening on and connecting to UNIX
sockets. Since a lot of code assumes, for example, that an IP address
and a port number is present, this socket will behave weirdly in various
situations, for example when listing all sockets and their remote
address. However, transferring data does work.

This also adds a simple test program to demonstrate this new support.
This program is an echo server and client in one process. It listens on
a UNIX socket, connects to it and sends the string "Hello World!" back
and forth. When run, the output is:

    Incoming connection from localhost on port 0
    Echoing: Hello World!
    Client disconnected

We can already see in this output that the remote address is not
identified correctly.

Since this program leaves the socket behind (does not delete the
socket), running the sample program again results in:

    Listener error: Address already in use
    Failed to listen on 'echo'!

Addresses: https://github.com/jimloco/Csocket/issues/68
Signed-off-by: Uli Schlachter <redacted>
Csocket.cc
Csocket.h
examples/Makefile
examples/UnixSocket.cc [new file with mode: 0644]