MCPcopy Create free account
hub / github.com/attermann/microReticulum / server

Function server

examples/link_native/src/main.cpp:104–127  ·  view source on GitHub ↗

This initialisation is executed when the users chooses to run as a server

Source from the content-addressed store, hash-verified

102// This initialisation is executed when the users chooses
103// to run as a server
104void server() {
105
106 // Randomly create a new identity for our link example
107 RNS::Identity server_identity = RNS::Identity();
108
109 // We create a destination that clients can connect to. We
110 // want clients to create links to this destination, so we
111 // need to create a "single" destination type.
112 RNS::Destination server_destination = RNS::Destination(
113 server_identity,
114 RNS::Type::Destination::IN,
115 RNS::Type::Destination::SINGLE,
116 APP_NAME,
117 "linkexample"
118 );
119
120 // We configure a function that will get called every time
121 // a new client creates a link to this destination.
122 server_destination.set_link_established_callback(client_connected);
123
124 // Everything's ready!
125 // Let's Wait for client requests or user input
126 server_loop(server_destination);
127}
128
129
130/*

Callers 1

mainFunction · 0.70

Calls 4

server_loopFunction · 0.70
IdentityClass · 0.50
DestinationClass · 0.50

Tested by

no test coverage detected