mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 22:38:27 +08:00
Add support for custom addressing by supplying a TsapPair to the PLC. CPU, Rack and Slot properties are still present to preserve backwards compatibility and to support alternate functionality based on the PLC type.
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
namespace S7.Net.Protocol
|
|
{
|
|
internal static class ConnectionRequest
|
|
{
|
|
public static byte[] GetCOTPConnectionRequest(TsapPair tsapPair)
|
|
{
|
|
byte[] bSend1 = {
|
|
3, 0, 0, 22, //TPKT
|
|
17, //COTP Header Length
|
|
224, //Connect Request
|
|
0, 0, //Destination Reference
|
|
0, 46, //Source Reference
|
|
0, //Flags
|
|
193, //Parameter Code (src-tasp)
|
|
2, //Parameter Length
|
|
tsapPair.Local.FirstByte, tsapPair.Local.SecondByte, //Source TASP
|
|
194, //Parameter Code (dst-tasp)
|
|
2, //Parameter Length
|
|
tsapPair.Remote.FirstByte, tsapPair.Remote.SecondByte, //Destination TASP
|
|
192, //Parameter Code (tpdu-size)
|
|
1, //Parameter Length
|
|
10 //TPDU Size (2^10 = 1024)
|
|
};
|
|
|
|
return bSend1;
|
|
}
|
|
}
|
|
}
|