23 #include <netcomm/fawkes/client.h> 24 #include <netcomm/fawkes/client_handler.h> 25 #include <utils/system/argparser.h> 26 #include <utils/system/signal.h> 51 printf(
"Got deregistered\n");
60 unsigned int id)
throw()
62 if ( m->payload_size() ==
sizeof(
unsigned int) ) {
63 unsigned int *u = (
unsigned int *)m->payload();
64 printf(
"Received message of type %hu with payload u=%u\n", m->msgid(), *u);
66 printf(
"Received message of invalid size, ignoring\n");
73 printf(
"Connection died.\n");
80 printf(
"Connection established\n");
95 main(
int argc,
char **argv)
106 unsigned int *u = (
unsigned int *)malloc(
sizeof(
unsigned int));;
108 if ( (tmp = argp.
arg(
"n")) != NULL ) {
115 if ( (tmp = argp.
arg(
"i")) != NULL ) {
127 c->
wait(FAWKES_CID_EXAMPLE_PLUGIN);
Message handler for FawkesNetworkClient.
const char * arg(const char *argn)
Get argument value.
Simple Fawkes network client.
Fawkes library namespace.
void disconnect()
Disconnect socket.
void register_handler(FawkesNetworkClientHandler *handler, unsigned int component_id)
Register handler.
void enqueue(FawkesNetworkMessage *message)
Enqueue message to send.
void wait(unsigned int component_id, unsigned int timeout_sec=15)
Wait for messages for component ID.
Representation of a message that is sent over the network.
void connect()
Connect to remote.
Parse command line arguments.
virtual void connection_established(unsigned int id)
Client has established a connection.
bool quit
Set to true if answer has been received or handler was deregistered.
Example Plugin network ping tool Small class that waits for a reply of the example plugin after a sho...
virtual void deregistered(unsigned int id)
The handler got deregistered.
virtual void connection_died(unsigned int id)
Client connection died.
virtual void inbound_received(FawkesNetworkMessage *m, unsigned int id)
Inbound mesage received.
void deregister_handler(unsigned int component_id)
Deregister handler.
ExamplePluginClientNetworkReceiver()
Constructor.