2014-05-08 16:44:01 +02:00
|
|
|
/*@!Encoding:1252*/
|
|
|
|
|
|
|
|
includes
|
|
|
|
{
|
|
|
|
#include "UdpCommon.cin"
|
2014-05-09 15:39:16 +02:00
|
|
|
#include "ModbusClientCommon.cin"
|
2014-05-08 16:44:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModbusConnectTo(char Remote_IP[], word Remote_Port)
|
|
|
|
{
|
2014-05-21 13:26:45 +02:00
|
|
|
UdpConnectTo(Remote_IP, Remote_Port);
|
2014-05-08 16:44:01 +02:00
|
|
|
}
|
|
|
|
|
2014-05-21 13:38:59 +02:00
|
|
|
void ModbusConnectTo(dword Remote_IP, word Remote_Port)
|
|
|
|
{
|
|
|
|
UdpConnectTo(Remote_IP, Remote_Port);
|
|
|
|
}
|
|
|
|
|
2014-05-21 13:26:45 +02:00
|
|
|
void ModbusSnd(byte buffer[], word length)
|
2014-05-12 10:46:53 +02:00
|
|
|
{
|
|
|
|
UdpSnd(buffer, length);
|
2014-05-08 16:44:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModbusRecv()
|
|
|
|
{
|
|
|
|
UdpRecv();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnUdpReceiveFrom(dword socket, long result, dword address, dword port, byte buffer[], dword size)
|
|
|
|
{
|
2014-05-12 10:46:53 +02:00
|
|
|
OnModbusReceive(socket, result, address, port, buffer, size);
|
|
|
|
if (result == 0 && size != 0)
|
|
|
|
UdpRecv();
|
2014-05-08 16:44:01 +02:00
|
|
|
}
|