Commit 72ee68ee20283414a7fb459cb87825c060ddc6b9

Authored by Stéphane Raimbault
1 parent 8556e176

Reduce the difference with the MacOS X verion.

Showing 1 changed file with 2 additions and 7 deletions
modbus/modbus.c
... ... @@ -51,11 +51,6 @@
51 51  
52 52 #include "modbus.h"
53 53  
54   -#ifdef __APPLE_CC__
55   - #include <netdb.h>
56   - #define SOL_TCP getprotobyname("TCP")->p_proto
57   -#endif
58   -
59 54 #define UNKNOWN_ERROR_MSG "Not defined in modbus specification"
60 55  
61 56 static const uint8_t NB_TAB_ERROR_MSG = 12;
... ... @@ -1476,7 +1471,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param)
1476 1471 /* Set the TCP no delay flag */
1477 1472 /* SOL_TCP = IPPROTO_TCP */
1478 1473 option = 1;
1479   - ret = setsockopt(mb_param->fd, SOL_TCP, TCP_NODELAY,
  1474 + ret = setsockopt(mb_param->fd, IPPROTO_TCP, TCP_NODELAY,
1480 1475 (const void *)&option, sizeof(int));
1481 1476 if (ret < 0) {
1482 1477 perror("setsockopt");
... ... @@ -1486,7 +1481,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param)
1486 1481  
1487 1482 /* Set the IP low delay option */
1488 1483 option = IPTOS_LOWDELAY;
1489   - ret = setsockopt(mb_param->fd, SOL_TCP, IP_TOS,
  1484 + ret = setsockopt(mb_param->fd, IPPROTO_TCP, IP_TOS,
1490 1485 (const void *)&option, sizeof(int));
1491 1486 if (ret < 0) {
1492 1487 perror("setsockopt");
... ...