diff --git a/global.h b/global.h index 246d34c..c6dc601 100644 --- a/global.h +++ b/global.h @@ -35,7 +35,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.32_1609171455" +#define PROGRAM_VERSION "0.32_1609181000" #define MAX_PATHLEN 4096 diff --git a/tmc_dev.c b/tmc_dev.c index 4c74c45..540f3ab 100644 --- a/tmc_dev.c +++ b/tmc_dev.c @@ -133,8 +133,8 @@ int tmcdev_write(struct tmcdev *dev, const char *cmd) strcat(buf, "\n"); - if(!(!strncmp(buf, ":TRIG:STAT?", 11) || - !strncmp(buf, ":TRIG:SWE?", 10) || + if(!(!strncmp(buf, ":TRIG:STAT?", 11) || /* don't print these commands to the console */ + !strncmp(buf, ":TRIG:SWE?", 10) || /* because they are used repeatedly */ !strncmp(buf, ":WAV:DATA?", 10) || !strncmp(buf, ":WAV:MODE NORM", 14) || !strncmp(buf, ":WAV:FORM BYTE", 14) || diff --git a/tmc_lan.c b/tmc_lan.c index ae8eacb..da2b859 100644 --- a/tmc_lan.c +++ b/tmc_lan.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "tmc_dev.h" #include "utils.h" @@ -113,8 +114,15 @@ struct tmcdev * tmclan_open(const char *ip_address) return NULL; } - FD_ZERO(&tcp_fds); /* clear file descriptor pool */ - FD_SET(sockfd, &tcp_fds); /* add our filedescriptor to pool */ + int tcp_nodelay = 1; /* turn NODELAY on */ + + if(setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&tcp_nodelay, sizeof tcp_nodelay) == -1) + { + return NULL; + } + + FD_ZERO(&tcp_fds); /* clear file descriptor pool */ + FD_SET(sockfd, &tcp_fds); /* add our filedescriptor to pool */ timeout.tv_sec = 0; timeout.tv_usec = TMC_LAN_TIMEOUT; @@ -214,8 +222,8 @@ int tmclan_write(struct tmcdev *tmc_device __attribute__ ((unused)), const char strcat(buf, "\n"); - if(!(!strncmp(buf, ":TRIG:STAT?", 11) || - !strncmp(buf, ":TRIG:SWE?", 10) || + if(!(!strncmp(buf, ":TRIG:STAT?", 11) || /* don't print these commands to the console */ + !strncmp(buf, ":TRIG:SWE?", 10) || /* because they are used repeatedly */ !strncmp(buf, ":WAV:DATA?", 10) || !strncmp(buf, ":WAV:MODE NORM", 14) || !strncmp(buf, ":WAV:FORM BYTE", 14) ||