diff --git a/examples/2_dynamic_pdl/bob.c b/examples/2_dynamic_pdl/bob.c new file mode 100644 index 0000000000000000000000000000000000000000..977c6f29cb5bf721ab6b9f52b3ccc60fad8b31fd --- /dev/null +++ b/examples/2_dynamic_pdl/bob.c @@ -0,0 +1,34 @@ +#include +#include "../../reowolf.h" +#include "../utility.c" + +int main() { // BOB! + char * pdl = buffer_pdl("eg_protocols.pdl"); + + // BOB + Connector* c = connector_new(); + printf("configuring...\n"); + check("config ", connector_configure(c, pdl, "forward")); + check("bind 0 ", connector_bind_active(c, 0, "127.0.0.1:7000")); + check("bind 1 ", connector_bind_native(c, 1)); + printf("connecting...\n"); + check("connect", connector_connect(c, 5000)); + + int i; + for (i = 0; i < 3; i++) { + check("get ", connector_get(c, 0)); + check("sync", connector_sync(c, 1000)); + + int msg_len; + const unsigned char * msg; + check("read", connector_gotten(c, 0, &msg, &msg_len)); + + printf("Received one message `%s`!\n", msg); + } + + printf("destroying...\n"); + connector_destroy(c); + printf("exiting...\n"); + free(pdl); + return 0; +} \ No newline at end of file