From f89a58860e4e3c76ef3c2e85d47ff38eeaaabb55 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 15 Jul 2023 08:38:33 +0200 Subject: Minor changes --- src/client/Makefile | 15 --------------- src/client/main.c | 39 --------------------------------------- 2 files changed, 54 deletions(-) delete mode 100644 src/client/Makefile delete mode 100644 src/client/main.c (limited to 'src/client') diff --git a/src/client/Makefile b/src/client/Makefile deleted file mode 100644 index 1afa44c..0000000 --- a/src/client/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include $(CONF) -EXEC=client -CFLAGS+=-lzmq - -DEFINES=\ --DPUBLISHER_PORT=$(PUBLISHER_PORT) \ --DPUBLISHER_ADDR=$(PUBLISHER_ADDR) - -all: main.c - $(CC) $^ -o $(OUT)/$(EXEC) $(CFLAGS) $(DEFINES) - -clean: - rm -f $(OUT)/$(EXEC) - -.PHONY: clean 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 -#include -#include -#include - -#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 -- cgit v1.2.3