Added a bit more diagnostic info in case of a LAN send error.

merge-requests/1/merge
Teuniz 2021-03-12 09:51:01 +01:00
rodzic 3899af54d3
commit 573b1e68fe
2 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote" #define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.37_2102171920" #define PROGRAM_VERSION "0.37_2103120950"
#define MAX_PATHLEN 1024 #define MAX_PATHLEN 1024

Wyświetl plik

@ -42,6 +42,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h>
#include "tmc_dev.h" #include "tmc_dev.h"
#include "utils.h" #include "utils.h"
@ -79,9 +80,19 @@ static int tmclan_send(const char *str)
{ {
if(FD_ISSET(sockfd, &temp_tcp_fds)) /* check if our file descriptor is set */ if(FD_ISSET(sockfd, &temp_tcp_fds)) /* check if our file descriptor is set */
{ {
return send(sockfd, str, len, MSG_NOSIGNAL); len = send(sockfd, str, len, MSG_NOSIGNAL);
if(len == -1)
{
perror("send()");
}
return len;
} }
} }
else
{
perror("select()");
}
return -1; return -1;
} }