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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,830 次查看
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?



标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,294 次查看
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 项奖励
回复
1 回复
1,295 次查看
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 项奖励
回复