Networking Reference
In-Depth Information
if(!msg) {
break;
}
printf("Received: %s\n", msg);
zstr_send(socket, "world");
free(msg);
}
zsocket_destroy(context, socket);
zctx_destroy(&context);
return 0;
}
The client sends a "Hello" message to the server, receives the "world" message, and
writes the "world" message to a file:
/*
Request - Reply
Receive "world" in multi-parts.
client.c
*/
#include <stdio.h>
#include "czmq.h"
int main (int argc, char const *argv[]) {
zctx_t* context = zctx_new();
void* request = zsocket_new(context, ZMQ_REQ);
printf("Starting client...\n");
zsocket_connect(request, "tcp://localhost:5050");
zstr_send(request, "Hello");
 
Search MirCeyron ::




Custom Search