Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry committed Sep 18, 2024
1 parent 1f55596 commit d149867
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions testing/test_bins/udp_send.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <errno.h>

#include <sys/types.h>
#include <unistd.h>

#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;
}
}
Expand All @@ -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;
}

0 comments on commit d149867

Please sign in to comment.