It is not defined in the standard, but if you have a source address 0 for publishing, "appHandle->realIP" is used instead in your code. This is not the case for sending requests, this means that if tlp_request is sent with a source address of 0, a socket bound to address 0 is opened.
This may work in the case where the destination address is an unicast address, but in the case of a multicast it is not known on which interface the packet needs to be sent. It can be fixed with a small change:
In trdp_if.c, in the function "tlp_request":
ret = trdp_requestSocket(appHandle->iface,
appHandle->pdDefault.port,
(pSendParam != NULL) ? pSendParam : &appHandle->pdDefault.sendParam,
srcIpAddr,
0u,
TRDP_SOCK_PD,
appHandle->option,
FALSE,
-1,
&pReqElement->socketIdx,
0u);
should be:
ret = trdp_requestSocket(appHandle->iface,
appHandle->pdDefault.port,
(pSendParam != NULL) ? pSendParam : &appHandle->pdDefault.sendParam,
(srcIpAddr == VOS_INADDR_ANY) ? appHandle->realIP : srcIpAddr,
0u,
TRDP_SOCK_PD,
appHandle->option,
FALSE,
-1,
&pReqElement->socketIdx,
0u);
Yes, you're right; actually I don't like this parameter at all - the application session defines the interface (or IP) to be used already. I'm not sure about any use case - may be redundancy, but currently the second IP in openSession is not used either...
Actually, the source IP for any outgoing telegram should be defined through the session's IP address (i.e. interface). With only one interface this would be INADDR_ANY.
The only use case I can think of why you want to send on a different interface than the session was opened on, would be manual redundancy.
Nevertheless, the source IP is in the API and should be correctly supported.
Changing the srcIpAddr parameter must be done for all later uses (e.g. finding existing entries etc.). srcIpAddr when publishing must be handled accordingly!