socketplate ~main
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 runSocketplateApp("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.
- ~main released 9 months ago
- oceandrift/socketplate
- BSL-1.0
- Copyright © 2023 Elias Batek
- Authors:
- 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 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
46 downloads total
-
- Score:
- 0.4
- Short URL:
- socketplate.dub.pm