socketplate 0.25.0

Straightforward socket server: Puts the “fun” in socket programming + built-in CLI


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

socketplate

Puts the “fun” in socket programming.

Example: TCP echo server

import socketplate.app;

int main(string[] args) @safe
{
    return runSocketplateAppTCP("Simple echo server", args, delegate(SocketConnection connection)
    {
        ubyte[] buffer = new ubyte[](256);

        while (true) {
            ubyte[] receivedData = connection.receiveSlice(buffer);

            if (receivedData.length == 0)
                return connection.close();

            connection.send(receivedData);
        }
    });
}
# listen on IPv4 localhost TCP port 8080
./tcp-echo -S 127.0.0.1:8080

# how about IPv6 as well?
./tcp-echo -S 127.0.0.1:8080 -S [::1]:8080

# there’s more:
./tcp-echo --help

Manual

Visit the modules’ doc comments for further information.

Authors:
  • Elias Batek (0xEAB)
Dependencies:
none
Versions:
0.30.0 2024-Mar-12
0.29.0 2024-Mar-10
0.28.2 2024-Mar-10
0.28.1 2024-Mar-10
0.28.0 2024-Mar-10
Show all 20 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 45 downloads total

Score:
0.4
Short URL:
socketplate.dub.pm