Thread: Htons?

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    10

    Htons?

    Should htons be used on all data recieved by a winsock?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    no, it should not.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    htons shouldn't be used on any data received over a network it should be used on data sent over a network and then only when the remote peer expects it. ntohs is used on received data.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    10
    I see, could you possibly help with this problem?

    Type Conversions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Use of htons() and ntohs()
    By Andystudent in forum C Programming
    Replies: 4
    Last Post: 01-19-2006, 09:06 AM