[fpc-pascal]SetSocketOptions() in Linux
Bob Martin
bobmartin at ntlworld.com
Wed Dec 4 10:38:52 CET 2002
Hi Brad,
yes, this was a known bug for a long time, but a few months ago I read
in a newsgroup that it was fixed in the latest version of RXSOCK.DLL so
I changed the 5 programs where I used it to uncomment the line and sure
enough it now worked.
My rxsock is
"rxsock .dll 73308 A 17-09-01 11:01:46 C:\TCPIP\dll"
and I think it came with MCP2.
I use both
rc = SockSetSockOpt(s0,'Sol_Socket','So_ReuseAddr','ON')
and
rc = SockSetSockOpt(s,'SOL_SOCKET','SO_REUSEADDR',1)
and both seem to work !
Bob
Brad Campbell wrote:
> 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.
>
>
More information about the fpc-pascal
mailing list