E
Hello,
maybe somebody can help me: I am looking for a modbusTcp slave source code, in C or ++, for Linux. Does someone have such. Open source would be preferred.
I already tried one which I found on a link at modbus.org (modbus_tcp.h, modbus_tcp.c from Philip Costigan). While this code does work as master, the slave does not work.
However, I am not sure, if I used it correctly. First I called "set_up_tcp_slave()" which opens a socket and binds it to the port 502. Here AF_INET, ANADDR_ANY, SOCK_STREAM and IPPROTO is used by default. This function waits correctly until I try to connect with a master (I used Modbucfg: Windows, Visual C++ 6.0). When I connect from the master, a connection seems to be established (fd = 7). But then when the program is listening, it a) receives a timeout or b) select() delivers > 0 but recv() delivers -1. Thus in the program "socket failure" ist set. I don't know what these two functions do.
Greetings
Ernst
maybe somebody can help me: I am looking for a modbusTcp slave source code, in C or ++, for Linux. Does someone have such. Open source would be preferred.
I already tried one which I found on a link at modbus.org (modbus_tcp.h, modbus_tcp.c from Philip Costigan). While this code does work as master, the slave does not work.
However, I am not sure, if I used it correctly. First I called "set_up_tcp_slave()" which opens a socket and binds it to the port 502. Here AF_INET, ANADDR_ANY, SOCK_STREAM and IPPROTO is used by default. This function waits correctly until I try to connect with a master (I used Modbucfg: Windows, Visual C++ 6.0). When I connect from the master, a connection seems to be established (fd = 7). But then when the program is listening, it a) receives a timeout or b) select() delivers > 0 but recv() delivers -1. Thus in the program "socket failure" ist set. I don't know what these two functions do.
Greetings
Ernst