-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple client to go with the simple server
Added a simple client to go along with the simple server. Updated the project model and re-ran project scripts.
- Loading branch information
1 parent
3c92442
commit 8fdee31
Showing
8 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#### filemq_client - no title found | ||
|
||
Please add @header section in ../src/filemq_client.c. | ||
|
||
Please add @discuss section in ../src/filemq_client.c. | ||
|
||
This is the class interface: | ||
|
||
Please add @interface section in ../src/filemq_client.c. | ||
|
||
This is the class self test code: | ||
|
||
Please add @selftest section in ../src/filemq_client.c. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
filemq_client(1) | ||
================ | ||
|
||
NAME | ||
---- | ||
filemq_client - no title found | ||
|
||
SYNOPSIS | ||
-------- | ||
---- | ||
Please add @interface section in ../src/filemq_client.c. | ||
---- | ||
|
||
DESCRIPTION | ||
----------- | ||
|
||
Please add @header section in ../src/filemq_client.c. | ||
|
||
Please add @discuss section in ../src/filemq_client.c. | ||
|
||
EXAMPLE | ||
------- | ||
.From filemq_client_test method | ||
---- | ||
Please add @selftest section in ../src/filemq_client.c. | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
#include "filemq_classes.h" | ||
|
||
int main (int argc, char *argv []) | ||
{ | ||
if (argc < 2) { | ||
puts ("usage: filemq_client inbox-dir"); | ||
return 0; | ||
} | ||
|
||
// Create the client | ||
fmq_client_t *client = fmq_client_new ("tcp://localhost:5670", 1000); | ||
assert (client); | ||
fmq_client_verbose (client); | ||
|
||
// Set the clients storage location | ||
int rc = fmq_client_set_inbox (client, argv [1]); | ||
assert (rc >= 0); | ||
|
||
// Subscribe to the server's root | ||
rc = fmq_client_subscribe (client, "/"); | ||
assert (rc >= 0); | ||
|
||
// Get a reference to the msgpipe | ||
zsock_t *msgpipe = fmq_client_msgpipe (client); | ||
assert (msgpipe); | ||
|
||
// Setup a poller | ||
zpoller_t *poller = zpoller_new ( (void *) msgpipe, NULL); | ||
assert (poller); | ||
|
||
while (!zsys_interrupted) { | ||
void *sock = zpoller_wait (poller, 100); | ||
|
||
if (sock == msgpipe) { | ||
zmsg_t *msg = zmsg_recv ( (void *) msgpipe); | ||
zmsg_print (msg); | ||
zmsg_destroy (&msg); | ||
} | ||
else | ||
if (zpoller_terminated (poller)) { | ||
puts ("the poller terminated"); | ||
break; | ||
} | ||
} | ||
puts ("interrupted"); | ||
|
||
zpoller_destroy (&poller); | ||
fmq_client_destroy (&client); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters