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,
TCP Listener in CTRL
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: TCP Listener in CTRL
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
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
Thanx Martin,
Sounds good!
I'm going to test try it and let you know
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
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
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
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.
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.