func NewTCPClientHandler(address string, rack int, slot int, customConnectionType ...int) *TCPClientHandler {
	h := &TCPClientHandler{}
	h.Address = address
	h.Timeout = tcpTimeout
	h.IdleTimeout = tcpIdleTimeout
	//custom connection type
	if len(customConnectionType) > 0 {
		h.ConnectionType = customConnectionType[0] // Connect to the PLC as a OP or Other
	} else {
		h.ConnectionType = connectionTypePG // Connect to the PLC as a PG
	}
	remoteTSAP := uint16(h.ConnectionType)<<8 + (uint16(rack) * 0x20) + uint16(slot)
	h.setConnectionParameters(address, 0x0100, remoteTSAP)
	return h
}
// NewTCPClientHandler allocates a new TCPClientHandler.
NewTCPClientHandler allocates a new TCPClientHandler.
// NewTCPClientHandler allocates a new TCPClientHandler .
func NewTCPClientHandler(address string, rack int, slot int, customConnectionType ...int) *TCPClientHandler {
	h := &TCPClientHandler{}
	h.Address = address
	h.Timeout = tcpTimeout
	h.IdleTimeout = tcpIdleTimeout
	if len(customConnectionType) > 0 {
		h.ConnectionType = customConnectionType[0] 
	} else {
		h.ConnectionType = connectionTypePG 
	}
	remoteTSAP := uint16(h.ConnectionType)<<8 + (uint16(rack) * 0x20) + uint16(slot)
	h.setConnectionParameters(address, 0x0100, remoteTSAP)
	return h
}
func NewTCPClientHandler ( address string , rack int , slot int , customConnectionType ... int ) * TCPClientHandler { h := & TCPClientHandler { } h . Address = address h . Timeout = tcpTimeout h . IdleTimeout = tcpIdleTimeout if len ( customConnectionType ) > 0 { h . ConnectionType = customConnectionType [ 0 ] } else { h . ConnectionType = connectionTypePG } remoteTSAP := uint16 ( h . ConnectionType ) << 8 + ( uint16 ( rack ) * 0x20 ) + uint16 ( slot ) h . setConnectionParameters ( address , 0x0100 , remoteTSAP ) return h }
NewTCPClientHandler allocates a new TCPClientHandler.
NewTCPClientHandler allocates a new TCPClientHandler .
//custom connection type // Connect to the PLC as a OP or Other // Connect to the PLC as a PG