Files
Modbus.Net/NA200H/ModBus.Net/TCPProtocalLinker.cs
2014-07-31 17:08:48 +08:00

25 lines
619 B
C#

namespace ModBus.Net
{
public class TCPProtocalLinker : ProtocalLinker
{
private static TCPSocket _socket;
public TCPProtocalLinker()
{
if (_socket == null)
{
_socket = new TCPSocket(ConfigurationManager.IP, int.Parse(ConfigurationManager.Port), false);
}
}
public override byte[] SendReceive(byte[] content)
{
return _socket.SendMsg(content);
}
public override bool SendOnly(byte[] content)
{
return _socket.SendMsgWithoutReturn(content);
}
}
}