[Solved] Siemens TRCV_C not working


I’m trying to get the TRCV_C working in Tia portal, however it is not working and I don’t know why. I managed to get TSEND_C working.
This is what the function looks like right now.

I’m using socketTest V3.0.0 to test the communication. When I have an active connection and try to type something I can not find if the data is received.

This is the watch table I use to watch the variables. The status says: 7006 which means the connection is active and ready to receive data. But when I type something in socketTest nothing changes on the watch table. I use port 4000 on TCP.

all help is welcome.

Kind regards,


I managed to get data through. By setting ADHOC to “true” instead of “false”. But there is still a problem where the first two characters are cut of. For example: I send: ‘123456789’ I receive: ‘3456789’. By putting two spaces in front of the send data I am able to receive everything but I don’t like that method. if anyone knows how to receive all the data without losing the first two characters that would be great!

I think you can find the answer in the help file of the block in TIA Portal. Click on the block and then press F1.

I have added the relevant information below:

You can try the following:

If you want to use ad-hoc mode (ADHOC = true):

  • Change the data type of recvData(DATA) to ARRAY of BYTE (probably ARRAY of Char will also work, but I’m not sure).
  • Or disable optimized block access of the TSEND_DB block. You can find this setting by right clicking on the block in the project tree -> Properties -> Attributes -> Uncheck “Optimized block access”.

When disabling ad-hoc mode (ADHOC = false):

  • Make sure the LEN parameter is set. Only when LEN is equal to RCVD_LEN the data will be available.

When I’m in class you can always ask me to help with this or when you have other questions about Siemens :slight_smile: .


setting recvData(DATA) to ARRAY of BYTE instead of string works! Thanks!

Thanks for your response!