Publication 1766-RM001A-EN-P - October 2008
Socket Interface Using CIP Generic Messaging
491
When issuing multiple Read services, be careful to adjust the destination
data table that receives the data so that data is not overwritten. This
fragment of Structured Text logic shows an example of handling a partial
Read service.
/* copy the message we just read */
CPW ( ReadResponse.Buf[0], ReadBuf[CurrentLen], ReadResponse.BufLen );
CurrentLen := Curr ReadResponse.BufLen;
/* do we need to read more data get a complete message? */
if ( CurrentLen < ApplicationMsgLen ) then
/* issue another read */
ReadParams.BufLen := ApplicationMsgLen - CurrentLen;
MSG ( ReadMSG0 );
end_if;
Partial Writes
Your program may need to handle the situation, although uncommon,
where the Write service is unable to send all the specified bytes. Such a
situation can occur if the Write service is called multiple times before the
target application can receive the data.
If the Write service is not able to send all of the requested data, your
program should issue subsequent Writes to send the remaining data. Your
program should also adjust the source data table, so that old data is not
sent.
Socket Object Services
The Socket Object supports the following services.
IMPORTANT
If you do not issue consecutive Read services, the rest of the application
data will be lost. For example, if the application data
size is 100 bytes and you issued a Read service with 50 bytes, you should
read the rest of data 50 bytes with consecutive Read service. If you issued
a Write service without consecutive Read service, the rest of data 50 bytes
will be lost.
Socket Service
CreateSocket
OpenConnection
AcceptConnection
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive