From d14986756c467bcba6c9dcccfaddad535290d33a Mon Sep 17 00:00:00 2001 From: fearful-symmetry Date: Wed, 18 Sep 2024 09:42:36 -0700 Subject: [PATCH] format --- testing/test_bins/udp_send.c | 41 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/testing/test_bins/udp_send.c b/testing/test_bins/udp_send.c index 96f2824a..a72198b0 100644 --- a/testing/test_bins/udp_send.c +++ b/testing/test_bins/udp_send.c @@ -1,25 +1,23 @@ +#include +#include +#include +#include +#include #include #include -#include #include -#include -#include #include -#include -#include #include -#include -#include - +#include +#include #define BUFFER_SIZE 512 char buffer[BUFFER_SIZE]; -void create_buffer(uint8_t* buffer, size_t length) +void create_buffer(uint8_t *buffer, size_t length) { - for (size_t i = 0; i < length; i++) - { + for (size_t i = 0; i < length; i++) { buffer[i] = 0xff; } } @@ -31,25 +29,22 @@ int main(int argc, char **argv) create_buffer(buffer, sizeof(buffer)); - sockfd = socket(AF_INET, SOCK_DGRAM, 0); - if (sockfd < 0) - { + if (sockfd < 0) { fprintf(stderr, "Error opening socket"); return -1; } - bzero((char*)&server, sizeof(server)); - server.sin_family = AF_INET; + bzero((char *)&server, sizeof(server)); + server.sin_family = AF_INET; server.sin_addr.s_addr = inet_addr("127.0.0.1"); - server.sin_port = htons(53); + server.sin_port = htons(53); printf("sending...\n"); - if (sendto(sockfd, &buffer, BUFFER_SIZE, 0,(const struct sockaddr*)&server, sizeof(server)) < 0) - { - fprintf(stderr, "Error in sendto()\n"); - return -1; - } - + if (sendto(sockfd, &buffer, BUFFER_SIZE, 0, (const struct sockaddr *)&server, sizeof(server)) < + 0) { + fprintf(stderr, "Error in sendto()\n"); + return -1; + } return 0; } \ No newline at end of file