SO_RCVTIMEO

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SO_RCVTIMEO

Paul Davidson
Trying to get SetSocketOptions for SO_RCVTIMEO and SO_SNDTIMEO to work
with Darwin (FreeBSD).

type
   p : pointer;
   t : TimeVal;

t.tv_sec := mSec div 1000;
t.tv_usec := ( mSec mod 1000 ) * 1000;
p := @t;
if SetSocketOptions( fSocket, SOL_SOCKET, SO_SNDTIMEO, p, SizeOf( t ) )
<> 0 etc

returns "Math argument out of domain of func", i.e. EDOM error.

Reference http://www.rocketaware.com/man/man2/getsockopt.2.htm
Different OS's use different types.  MS uses pointer to integer, while
others use a timeval structure.

An suggestions?

P D

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: SO_RCVTIMEO

Anton Tichawa
Paul Davidson wrote:

> Trying to get SetSocketOptions for SO_RCVTIMEO and SO_SNDTIMEO to work
> with Darwin (FreeBSD).
>
> type
>   p : pointer;
>   t : TimeVal;
>
> t.tv_sec := mSec div 1000;
> t.tv_usec := ( mSec mod 1000 ) * 1000;
> p := @t;
> if SetSocketOptions( fSocket, SOL_SOCKET, SO_SNDTIMEO, p, SizeOf( t )
> ) <> 0 etc
>
According to my docs, SetSocketOptions is declared

function SetSocketOptions(

  Sock: LongInt;

  Level: LongInt;

  OptName: LongInt;

  const OptVal;

  optlen: LongInt

):LongInt;


So, I think you should pass p^ (the data pointed to by p) rather than p.

HTH,

Anton.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: SO_RCVTIMEO

Marco van de Voort
In reply to this post by Paul Davidson
> Trying to get SetSocketOptions for SO_RCVTIMEO and SO_SNDTIMEO to work
> with Darwin (FreeBSD).
>
> type
>    p : pointer;
>    t : TimeVal;
>
> t.tv_sec := mSec div 1000;
> t.tv_usec := ( mSec mod 1000 ) * 1000;
> p := @t;
> if SetSocketOptions( fSocket, SOL_SOCKET, SO_SNDTIMEO, p, SizeOf( t ) )
> <> 0 etc
>
> returns "Math argument out of domain of func", i.e. EDOM error.
>
> Reference http://www.rocketaware.com/man/man2/getsockopt.2.htm
> Different OS's use different types.  MS uses pointer to integer, while
> others use a timeval structure.
>
> An suggestions?

google "freebsd sol_socket so_sndtimeo"

yields:

http://66.249.93.104/search?q=cache:1LP6r0fqaU4J:dbforums.com/arch/186/2003/1/654712+sol_socket+freebsd+so_sndtimeo&hl=en
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: SO_RCVTIMEO

Paul Davidson
Thanks, Marco, Anton.  Select it is!

On Sep 14, 2005, at 9:08, Marco van de Voort wrote:

>> Trying to get SetSocketOptions for SO_RCVTIMEO and SO_SNDTIMEO to work
>> with Darwin (FreeBSD).
>>
>> type
>>    p : pointer;
>>    t : TimeVal;
>>
>> t.tv_sec := mSec div 1000;
>> t.tv_usec := ( mSec mod 1000 ) * 1000;
>> p := @t;
>> if SetSocketOptions( fSocket, SOL_SOCKET, SO_SNDTIMEO, p, SizeOf( t )  
>> )
>> <> 0 etc
>>
>> returns "Math argument out of domain of func", i.e. EDOM error.
>>
>> Reference http://www.rocketaware.com/man/man2/getsockopt.2.htm
>> Different OS's use different types.  MS uses pointer to integer, while
>> others use a timeval structure.
>>
>> An suggestions?
>
> google "freebsd sol_socket so_sndtimeo"
>
> yields:
>
> http://66.249.93.104/search?q=cache:1LP6r0fqaU4J:dbforums.com/arch/ 
> 186/2003/1/654712+sol_socket+freebsd+so_sndtimeo&hl=en
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
P Davidson
Corax Networks Inc.
http://CoraxNetworks.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal