[fpc-pascal]SetSocketOptions() in Linux

Brad Campbell brad at seme.com.au
Wed Dec 4 10:23:45 CET 2002


G'day all,

This has been a problem for me for a couple of years and I have only
just solved it. (It was not a high priority).

S is a Socket.
I wanted to 
SetSocketOptions(S,SOL_SOCKET,SO_REUSEADDR,1,Sizeof(1));

I looked at heaps of C source, and they did it with an int
variable. So I used

Var
	Temp : Integer;

Temp := 1;
SetSocketOptions(S,SOL_SOCKET,SO_REUSEADDR,Temp,Sizeof(Temp));

This never worked, but it turns out that

Const
	Temp = 1;
SetSocketOptions(S,SOL_SOCKET,SO_REUSEADDR,Temp,Sizeof(Temp));

Or 

SetSocketOptions(S,SOL_SOCKET,SO_REUSEADDR,1,Sizeof(1));

Both work fine.
Why does the first one fail and both the second ones work.
What am I missing.

I have solved the problem and I'm much happier for it, but I'd like
to know what basic concept I'm not grasping.


-- 
Brad....
                   /"\
Save the Forests   \ /     ASCII RIBBON CAMPAIGN
Burn a Greenie.     X      AGAINST HTML MAIL
                   / \




More information about the fpc-pascal mailing list