From 0978e237af3f26070b4824e09a7730aad44c3d0d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 10 Dec 2020 23:17:40 +0100 Subject: Make receiver work on sub directories --- sender.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sender.c') diff --git a/sender.c b/sender.c index d940e17..9cc7a71 100644 --- a/sender.c +++ b/sender.c @@ -83,13 +83,6 @@ void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) { } int main() { - mbedtls_ctr_drbg_context ctr_drbg; - mbedtls_entropy_context entropy; - - mbedtls_entropy_init(&entropy); - mbedtls_ctr_drbg_init(&ctr_drbg); - mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, pp, sizeof(pp)); - struct addrinfo hints, *result, *rp; memset (&hints, 0, sizeof (hints)); hints.ai_socktype = SOCK_DGRAM; @@ -109,10 +102,19 @@ int main() { errx(EXIT_FAILURE, "Can't open socket"); freeaddrinfo(result); + // Setup + mbedtls_ctr_drbg_context ctr_drbg; + mbedtls_entropy_context entropy; + + mbedtls_entropy_init(&entropy); + mbedtls_ctr_drbg_init(&ctr_drbg); + mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, pp, sizeof(pp)); + new_session(sock, &ctr_drbg); sleep(3); + // Fire const unsigned char *logline = (const unsigned char*)"Juchuuu, es klappt!\n"; send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); -- cgit v1.2.3