diff --git a/examples/bench_3/putter.c b/examples/bench_3/putter.c new file mode 100644 index 0000000000000000000000000000000000000000..4d08f71ca2e9a68570db242a08d39b62619a5db0 --- /dev/null +++ b/examples/bench_3/putter.c @@ -0,0 +1,35 @@ +#include "../../reowolf.h" +#include "../utility.c" +int main(int argc, char** argv) { + Arc_ProtocolDescription * pd = protocol_description_parse("", 0); + char logpath[] = "./3_16_putter.txt"; + Connector * c = connector_new_logging_with_id(pd, logpath, sizeof(logpath)-1, 1); + rw_err_peek(c); + + PortId putter; + FfiSocketAddr addr = {{192, 168, 1, 124}, 8009}; + rw_err_peek(c); + connector_add_net_port(c, &putter, addr, Polarity_Putter, EndpointPolarity_Active); + connector_connect(c, -1); + rw_err_peek(c); + + // Prepare a message to send + size_t msg_len = 16; + char * msg_ptr = malloc(msg_len); + memset(msg_ptr, 42, msg_len); + + int i; + for(i=0; i<10; i++) { + connector_put_bytes(c, putter, msg_ptr, msg_len); + rw_err_peek(c); + connector_sync(c, -1); + rw_err_peek(c); + } + + printf("Exiting\n"); + protocol_description_destroy(pd); + connector_destroy(c); + free(msg_ptr); + sleep(1.0); + return 0; +} \ No newline at end of file