mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Problem: use of unqualified "id" in code example
Solution: use "routing_id" instead
This commit is contained in:
parent
0874eec803
commit
cd55c62499
@ -559,16 +559,16 @@ void *socket = zmq_socket (ctx, ZMQ_STREAM);
|
||||
assert (socket);
|
||||
int rc = zmq_bind (socket, "tcp://*:8080");
|
||||
assert (rc == 0);
|
||||
/* Data structure to hold the ZMQ_STREAM ID */
|
||||
uint8_t id [256];
|
||||
size_t id_size = 256;
|
||||
/* Data structure to hold the ZMQ_STREAM routing id */
|
||||
uint8_t routing_id [256];
|
||||
size_t routing_id_size = 256;
|
||||
/* Data structure to hold the ZMQ_STREAM received data */
|
||||
uint8_t raw [256];
|
||||
size_t raw_size = 256;
|
||||
while (1) {
|
||||
/* Get HTTP request; ID frame and then request */
|
||||
id_size = zmq_recv (socket, id, 256, 0);
|
||||
assert (id_size > 0);
|
||||
/* Get HTTP request; routing id frame and then request */
|
||||
routing_id_size = zmq_recv (socket, routing_id, 256, 0);
|
||||
assert (routing_id_size > 0);
|
||||
do {
|
||||
raw_size = zmq_recv (socket, raw, 256, 0);
|
||||
assert (raw_size >= 0);
|
||||
@ -579,11 +579,11 @@ while (1) {
|
||||
"Content-Type: text/plain\r\n"
|
||||
"\r\n"
|
||||
"Hello, World!";
|
||||
/* Sends the ID frame followed by the response */
|
||||
zmq_send (socket, id, id_size, ZMQ_SNDMORE);
|
||||
/* Sends the routing id frame followed by the response */
|
||||
zmq_send (socket, routing_id, routing_id_size, ZMQ_SNDMORE);
|
||||
zmq_send (socket, http_response, strlen (http_response), 0);
|
||||
/* Closes the connection by sending the ID frame followed by a zero response */
|
||||
zmq_send (socket, id, id_size, ZMQ_SNDMORE);
|
||||
/* Closes the connection by sending the routing id frame followed by a zero response */
|
||||
zmq_send (socket, routing_id, routing_id_size, ZMQ_SNDMORE);
|
||||
zmq_send (socket, 0, 0, 0);
|
||||
}
|
||||
zmq_close (socket);
|
||||
|
Loading…
Reference in New Issue
Block a user