summaryrefslogtreecommitdiff
path: root/src/client/main.c
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 08:38:33 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 08:38:33 +0200
commitf89a58860e4e3c76ef3c2e85d47ff38eeaaabb55 (patch)
treeed5af12adc1654f8a480a1669d6d8b5bde8703e4 /src/client/main.c
parentc84520472c10a5085dc9004ed3b7c8019d01c4f9 (diff)
Minor changes
Diffstat (limited to 'src/client/main.c')
-rw-r--r--src/client/main.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/client/main.c b/src/client/main.c
deleted file mode 100644
index e4b3498..0000000
--- a/src/client/main.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// Weather update client
-// Connects SUB socket to tcp://localhost:5556
-// Collects weather updates and finds avg temp in zipcode
-#include <zmq.h>
-#include <assert.h>
-#include <time.h>
-#include <string.h>
-
-#include "../utils.h"
-
-
-int main (int argc, char *argv [])
-{
- // Socket to talk to server
- printf ("Collecting updates from weather server...\n");
- void *context = zmq_ctx_new ();
- void *subscriber = zmq_socket (context, ZMQ_SUB);
- int rc = zmq_connect (subscriber, "tcp://"STRINGIFY(PUBLISHER_ADDR)":"STRINGIFY(PUBLISHER_PORT));
- assert (rc == 0);
-
- // Subscribe to zipcode, default is NYC, 10001
- // Subscribe to zipcode, default is NYC, 10001
- const char *filter = "Hello";
- rc = zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE,
- filter, strlen(filter));
- assert (rc == 0);
-
- // Process 100 updates
- int update_nbr;
- char buffer[10];
- for (update_nbr = 0; update_nbr < 100; update_nbr++) {
- zmq_recv (subscriber, buffer, 10, 0);
- printf("Received!");
- }
-
- zmq_close (subscriber);
- zmq_ctx_destroy (context);
- return 0;
-} \ No newline at end of file