문제

When I am writing port to SOCKADDR_IN structure, can I use 0x5000 instead of htons(80)?

(Why 0x5000? -- I debugged htons(80) and it returned 0x5000)

도움이 되었습니까?

해결책

You can but it won't be portable. htons exists for you not to worry about byte ordering in your computer and network (and they can be different on various systems).

다른 팁

You can, but why would you want to? What's the problem with being portable? and clear? and the same as everyone else who has ever written this code?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top