TCP Listener in CTRL

Find and share HowTos to various installations / configurations!
5 posts • Page 1 of 1
marcel@realsolutions.nu
Posts:12
Joined: Mon Aug 02, 2010 10:22 am

TCP Listener in CTRL

Post by marcel@realsolutions.nu »

Hello,

Is there anybody that has found a way for TCP listening in the CTRL language? (maybe a CTRL extension)

I need to open a TCP port for listening, and report the data as soon as a device is connecting to this port and sends data. (I also need to know his IP and port nr.)

Hope somebody can help me with this!


Kind regards,

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: TCP Listener in CTRL

Post by mkoller »

I've created a quick solution for this in a ctrl extension.
See attached example. You use it like this:

#uses "CtrlTcpServer"

main()
{
DebugN(tcpServer(5555, "callback"));
}

callback(string data, string host)
{
DebugN("incoming call from ", host, data);
} https://www.winccoa.com/fileadmin/image ... Server.zip
Attachments
TcpServer.zip
(4.2 KiB) Downloaded 212 times

marcel@realsolutions.nu
Posts:12
Joined: Mon Aug 02, 2010 10:22 am

Re: TCP Listener in CTRL

Post by marcel@realsolutions.nu »

Thanx Martin,

Sounds good!
I'm going to test try it and let you know

pke-vt-mit
Posts:1
Joined: Mon Dec 14, 2015 8:12 am

Re: TCP Listener in CTRL

Post by pke-vt-mit »

Hello

We compiled the example code for 3.10.2 32Bit and it works fine.

After that we tried to compile the example code for 3.11 64Bit and we got following error:

TcpServer.cxx
C:\\Siemens\\Automation\\WinCC_OA\\3.11\\api\\include\\BCMNew\\ItcDispatcher.h(28): fatal error C1083: Cannot open include file: 'QQueue': No such file or directory
TcpServerExternHdl.cxx
C:\\Siemens\\Automation\\WinCC_OA\\3.11\\api\\include\\BCMNew\\ItcDispatcher.h(28): fatal error C1083: Cannot open include file: 'QQueue': No such file or directory
Generating Code...


IDE: Visual Studio 2010
Compiler: VC 10 compiler (Microsoft C/C++ Optimizing Compiler Version 16.00.30319.01 for x64)

See Attachment (Visual Studion Project) Rename .zip to .7z
https://www.winccoa.com/fileadmin/image ... Server.zip
Attachments
CtrlTcpServer.zip
(8.07 MiB) Downloaded 225 times

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: TCP Listener in CTRL

Post by mkoller »

Oh great ... not good. The problem is that the mentioned header file uses some Qt classes but we are not allowed to deliver Qt header files.
Our public API should really not need Qt header includes.
This must be fixed on our side.
In the meantime as a workaround you can download Qt sources (or at least the mentioned header files) from the Qt project (Qt version 4.8.4):
http://download.qt.io/archive/qt/4.8/4.8.4/
and make sure the compiler finds QQueue etc.

5 posts • Page 1 of 1