Do I need to use htons/htonl when setting up TCP and UDP comms using p1025 QorIQ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Do I need to use htons/htonl when setting up TCP and UDP comms using p1025 QorIQ?

Jump to solution
999 Views
clivestokes
Contributor I

I am new to TCP and UDP  comms and am working with code that has worked on the TWR QorIQ MPU Tower System Module but under QNX.

The code sets up the client and remote socket info using htons on the ports and htonl on the remote address which I assumed would be unchanged (same processor) when the code was ported to work under MQX. However I  note from the discussion headed htons problem with K60?  MQX bug? that MQX may be non-standard in this area. Can someone provide clarification?



Labels (1)
Tags (2)
0 Kudos
1 Solution
463 Views
butok
NXP Employee
NXP Employee

Hi Clive,

This is legacy feature of RTCS. Port and IPv4 address are in host-endian format.

Yes. It is very confusion, especially for somebody who came from other stack.

I would change it, even if it will require rewriting of existing application, just to follow some BSD-Socket approach.

Before we do it (as it will break all existing RTCS application), I need to see that there is real support of this change from MQX/RTCS community

Thank you,

Andrey Butok

View solution in original post

0 Kudos
1 Reply
464 Views
butok
NXP Employee
NXP Employee

Hi Clive,

This is legacy feature of RTCS. Port and IPv4 address are in host-endian format.

Yes. It is very confusion, especially for somebody who came from other stack.

I would change it, even if it will require rewriting of existing application, just to follow some BSD-Socket approach.

Before we do it (as it will break all existing RTCS application), I need to see that there is real support of this change from MQX/RTCS community

Thank you,

Andrey Butok

0 Kudos