Declaration
unsigned int (_stdcall * WriteToLine)(HOBJ StID, void * Data, unsigned int Len);
Parameters
StIDCommunication station ID.
DataPointer to a buffer of the data to send.
LenNumber of bytes to send.
Description


The function writes data with specified length into Serial, MOXA IP Serial Library, SerialOverUDP Device Redundant or TCP-IP/TCP, in case of first two lines with parameters defined according to specified mode of a particular station.


Return value

True / False according to the function success.

Note: The following applies to TCP-IP/TCP line:

  • calling WriteToLine with a zero value of parameter Len just causes the TCP connection to be closed (this can be used, for example, in systems with instances of KOM processes or in redundant systems to close a TCP connection if the KOM process is passive or is connected to the SBS kernel)
  • calling the WriteToLine function with a non-zero  value of parameter Len triggers an attempt to establish a connection unless the connection has already been established
  • the WriteToLine function returns False if a write error has occurred (e.g., TCP connection was broken)
  • subsequent calling of the WriteToLine or ReadFromLine functions will cause an attempt to re-established the connection
  • if the connection is established, the requested operation is executed (WriteToLine - writing data, ReadFromLine- reading data)
  • if multiple IP addresses (separated by a comma or semicolon) are configured in the line configuration, the KOM process cyclically uses them to establish a connection to these IP addresses
Napíšte komentár