Skip to main content

SomeIpGetDestinationPort

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

dword SomeIpGetDestinationPort ( dword messageHandle );

Description

This function returns the destination port (UDP/TCP).

Parameters

  • messageHandle: Handle of the received SOME/IP message Note: This function can only be called within the OnSomeIpMessage callback function.

Return Values

  • Destination port: In the event of an error, the function returns the value 0. The SomeIpGetLastError function can then be used to check whether the value is valid or an error has occurred.

Example

void OnSomeIpMessage( DWORD messageHandle )
{
  DWORD dstPort       = 0;
  LONG  errorCode     = 0;
  LONG  errorOccured  = 0;

  // get data from SOME/IP message
  if((dstPort = SomeIpGetDestinationPort(messageHandle)) == 0)
  {
    // check if last function was executed correct
    if((errorCode = SomeIpGetLastError()) != 0)
    {
      write("SOME/IP IL error occured: Error code: %d", errorCode);
      errorOccured = 1;
    } // if
  } // if

  if(errorOccured == 0)
  {
    write("SOME/IP message received. Destination Port: %d",dstPort);
  } // if
}
See Also
- [SomeIpFillValues](CAPLfunctionSomeIpFillValues.md)
- [SomeIpGetDestinationAddress](CAPLfunctionSomeIpGetDestinationAddress.md)
- [SomeIpGetInterfaceVersion](CAPLfunctionSomeIpGetInterfaceVersion.md)
- [SomeIpGetLength](CAPLfunctionSomeIpGetLength.md)
- [SomeIpGetMessageId](CAPLfunctionSomeIpGetMessageId.md)
- [SomeIpGetMessageType](CAPLfunctionSomeIpGetMessageType.md)
- [SomeIpGetProtocol](CAPLfunctionSomeIpGetProtocol.md)
- [SomeIpGetProtocolVersion](CAPLfunctionSomeIpGetProtocolVersion.md)
- [SomeIpGetRequestId](CAPLfunctionSomeIpGetRequestId.md)
- [SomeIpGetReturnCode](CAPLfunctionSomeIpGetReturnCode.md)
- [SomeIpGetSourceAddress](CAPLfunctionSomeIpGetSourceAddress.md)
- [SomeIpGetSourcePort](CAPLfunctionSomeIpGetSourcePort.md)
- [SomeIpGetValue...](CAPLfunctionSomeIpGetValue.md)
- [SomeIpGetValueDWord](CAPLfunctionSomeIpGetValueDWord.md)
- [SomeIpGetValueFloat](CAPLfunctionSomeIpGetValueFloat.md)
- [SomeIpGetValueInt64](CAPLfunctionSomeIpGetValueInt64.md)
- [SomeIpGetValueLong](CAPLfunctionSomeIpGetValueLong.md)
- [SomeIpGetValuePhys](CAPLfunctionSomeIpGetValuePhys.md)
- [SomeIpGetValueQWord](CAPLfunctionSomeIpGetValueQWord.md)
- [SomeIpGetValueString](CAPLfunctionSomeIpGetValueString.md)
- [SomeIpRemoveValue](CAPLfunctionSomeIpRemoveValue.md)
- [SomeIpSetRequestId](CAPLfunctionSomeIpSetRequestId.md)
- [SomeIpSetReturnCode](CAPLfunctionSomeIpSetReturnCode.md)
- [SomeIpSetValue...](CAPLfunctionSomeIpSetValue.md)
- [SomeIpSetValueDWord](CAPLfunctionSomeIpSetValueDWord.md)
- [SomeIpSetValueFloat](CAPLfunctionSomeIpSetValueFloat.md)
- [SomeIpSetValueInt64](CAPLfunctionSomeIpSetValueInt64.md)
- [SomeIpSetValueLong](CAPLfunctionSomeIpSetValueLong.md)
- [SomeIpSetValuePhys](CAPLfunctionSomeIpSetValuePhys.md)
- [SomeIpSetValueQWord](CAPLfunctionSomeIpSetValueQWord.md)
- [SomeIpSetValueString](CAPLfunctionSomeIpSetValueString.md)
- [Syntax for Database-based Access Paths](CAPLfunctionSomeIpSyntaxDatabaseAccessPath.md)
- [Syntax for Predefined Service Discovery (SD) Access Paths](CAPLfunctionSomeIpSyntaxPredefinedSDAccessPath.md)