Files
@ a286c28bcdcf
Branch filter:
Location: CSY/reowolf/examples/2_dynamic_pdl/amy.c - annotation
a286c28bcdcf
834 B
text/x-csrc
new examples
952d4edf0cbb 952d4edf0cbb 952d4edf0cbb 33da6b69e9a2 952d4edf0cbb aa7efaf3fd9b 952d4edf0cbb 7e4b7b7026e6 7e4b7b7026e6 952d4edf0cbb 7e4b7b7026e6 952d4edf0cbb 33da6b69e9a2 a286c28bcdcf 49b9c766fe5a 49b9c766fe5a 33da6b69e9a2 33da6b69e9a2 952d4edf0cbb 7e4b7b7026e6 952d4edf0cbb 952d4edf0cbb 7e4b7b7026e6 33da6b69e9a2 33da6b69e9a2 952d4edf0cbb 952d4edf0cbb 7e4b7b7026e6 952d4edf0cbb 33da6b69e9a2 952d4edf0cbb 952d4edf0cbb | #include <stdio.h>
#include <string.h>
#include "../../reowolf.h"
#include "../utility.c"
int main() {
// Protocol is loaded from file.
char * pdl = buffer_pdl("eg_protocols.pdl");
// create a connector with one outgoing network channel.
Connector* c = connector_new();
printf("configuring...\n");
check("config ", connector_configure(c, pdl, "dynamic"));
check("bind 0 ", connector_bind_native(c, 0));
check("bind 1 ", connector_bind_passive(c, 1, "127.0.0.1:7000"));
printf("connecting...\n");
check("connect", connector_connect(c, 5000));
// send "hello" message three times
int i;
for (i = 0; i < 3; i++) {
check("put ", connector_put(c, 0, "hello", 5));
check("sync", connector_sync(c, 1000));
printf("Sent one message!\n");
}
printf("cleaning up\n");
connector_destroy(c);
free(pdl);
return 0;
}
|