[fpc-pascal]Socket problems

Martyn Ranyard ranyardm at lineone.net
Tue Jul 16 16:35:27 CEST 2002


At 04:13 PM 7/16/02 +0200, you wrote:
>Subject: [fpc-pascal]Socket problems
>
>This function is the problem. Due to different sizes of the Integer type
>in the different compiler modes the htons() function returns wrong
>values:
>
>In both -Sd and -S2 the Integer type is 32 bit, the lo() and hi()
>function return the lo() and hi() - *word* (not byte) of the given
>integer.
>E.g. lo(7878) = 7878 and hi(7878) = 0 so htons returns 2016768 which is
>likely invalid. =)
>Using -St or *no* compiler mode switch solves the problem.

Aha!  So, the fact that I am used to Delphi code (i.e. am using Exceptions 
and such) and am reading about internet programming in freepascal for the 
first time has knobbled me!

Thanks very much, reverting the Integers to Words has solved my problem, 
and I will look out for any changes in future, I'm stumped as to why it 
compiled and ran previously, but now I don't care. :)

You have made me a happy man. Thank you.

>Regards,
>   Thomas

Thank you again


Martyn Ranyard
Free Software Advocate

jabber - joran at amessage.de
icq    - 122500800
irc    - Joran on oftc
msn    - ranyardm at hotmail.com
y!     - ranyardm
e      - ranyardm at lineone.net





More information about the fpc-pascal mailing list