time to test

This commit is contained in:
2025-07-10 19:10:39 -06:00
parent 259dd096cb
commit 71346bdd5f
2 changed files with 15 additions and 5 deletions
+1
View File
@@ -1,5 +1,6 @@
#include <list.h> #include <list.h>
#include <stdlib.h> #include <stdlib.h>
LIST *ListCreate(void) {
LIST *new_list; LIST *new_list;
new_list = malloc(sizeof(LIST)); new_list = malloc(sizeof(LIST));
+14 -5
View File
@@ -59,6 +59,20 @@ void *receiver(void *arg) {
return 0; return 0;
} }
void *output(void *arg) {
char msg[30];
while (1) {
pthread_mutex_lock(&receivemut);
ListFirst(receivelist);
strcpy(msg, ListCurr(receivelist));
ListRemove(receivelist);
pthread_mutex_unlock(&receivemut);
printf("%s\n", msg);
}
return 0;
}
void *get_in_addr(struct sockaddr *sa) { void *get_in_addr(struct sockaddr *sa) {
if (sa->sa_family == AF_INET) { if (sa->sa_family == AF_INET) {
return &(((struct sockaddr_in*)sa)->sin_addr); return &(((struct sockaddr_in*)sa)->sin_addr);
@@ -94,11 +108,6 @@ int main(int argc, char* argv[]) {
printf("Error: receive mutex init failed\n"); printf("Error: receive mutex init failed\n");
return -1; return -1;
} }
if (pthread_cond_init(&sendcv, NULL) != 0) {
printf("Error: send CV init failed\n");
return -1;
}
local_port = argv[1]; local_port = argv[1];
remote_machine = argv[2]; remote_machine = argv[2];