![IXXAT CAN@net II/Generic Manual Download Page 29](http://html1.mh-extra.com/html/ixxat/canatnet-ii-generic/canatnet-ii-generic_manual_2098901029.webp)
CAN@net II/Generic, Version 1.5
Writing Applications
29
6 Writing Applications
This chapter gives some hints when writing applications for the ASCII-Protocol
and also describes a small demo application.
6.1 Windows Firewall Settings
The application must be able to communicate through the firewall of the local
PC. When the application is invoked the first time, the operation system asks for
permission to communicate through the firewall. To assign the permission to the
application, local administrator rights are necessary.
Another way to set the permission is via the Control Panel. Go to
Control Panel
– System and Security – Windows Defender Firewall – Allowed apps
, select
the application and make the appropriate settings.
The PC must get access to the port 19227/tcp of the CAN@net II from any port
(1024-65535). From its port 19227/tcp the CAN@net II must get access to the
PC ports 1024-65535.
6.2 TCP Streaming
When writing TCP applications in general, the data-stream character of TCP
must be considered. Let's have a look at an example:
Imagine, the CAN@net II/Generic receives 3 messages on the CAN bus. After
packing these three CAN messages into ASCII-Protocol messages they look as
shown in the table below:
Now these three messages will be handed over to the TCP/IP protocol stack
using the Socket API's
send()
call. There they will end up concatenated
somewhere in the TCP stack's send buffer:
M ED2 20 22 22 \r\n M ED2 30 33 33 \r\n M ED2 40 44 44 \r\n
From now on it is up to the TCP/IP protocol stack to handle these concatenated
messages. The TCP/IP will wrap these messages into TCP, then into IP and
then into Ethernet frames. Due to size restrictions within the wrapping protocols,
it can occur that only a part of the original ASCII messages is packed into an
Ethernet frame. The following table shows an example. Only the first two and
part of the third ASCII-Protocol message are packed into a network message.
M ED2 20 22 22 \r\n M ED2 30 33 33 \r\n M ED2 40 44
M ED2 20
22
22
\r\n
M ED2 30
33
33
\r\n
M ED2 40
44
44
\r\n