M17: UDP Socket Receiver and IP Frame Tweaks;

This commit is contained in:
lwvmobile
2024-04-09 01:20:22 -04:00
parent 129af0ba9e
commit 1f7ddbecdf
4 changed files with 79 additions and 19 deletions

View File

@@ -260,6 +260,12 @@ int UDPBind (char *hostname, int portno)
perror("ERROR on binding UDP Port");
}
//set these for non blocking when no samples to read
struct timeval read_timeout;
read_timeout.tv_sec = 0;
read_timeout.tv_usec = 10;
setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &read_timeout, sizeof read_timeout);
return sockfd;
}
@@ -318,6 +324,18 @@ int udp_socket_blaster(dsd_opts * opts, dsd_state * state, size_t nsam, void * d
if (err < nsam) fprintf (stderr, "\n UDP Underflow %ld", err); //I'm not even sure if this is possible
}
int m17_socket_receiver(dsd_opts * opts, void * data)
{
size_t err = 0;
struct sockaddr_in cliaddr;
socklen_t len = sizeof(cliaddr);
//receive data from socket
err = recvfrom(opts->udp_sockfd, data, MSG_WAITALL, 0, (struct sockaddr * ) & address, &len);
return err;
}
//Analog UDP port on +2 of normal open socket
int udp_socket_blasterA(dsd_opts * opts, dsd_state * state, size_t nsam, void * data)
{