I don't know that example in jforc had been tested. You may google.

11.03.2014, в 19:18, Pascal Jasmin <[email protected]> написал(а):

> I assume that setsockopt is already creating the structure for SO_linger.  It 
> is 2 ints, and so that code looks right?
> 
> JforC is 
> http://www.jsoftware.com/help/jforc/socket_programming.htm#_Toc191734441 .  
> It has sockopt examples at bottom, which may have become invalid a long time 
> ago if  setsockopt and getsockopt have had the linger special handling for a 
> while.
> 
> regarding SO_DONTLINGER, that is not a constant exported in either mac or 
> windows netdefs.  But winsock2.h has:
> 
> #define SO_DONTLINGER    (u_int)(~SO_LINGER)
> assuming that would be -. 128 (_127) gives an ENOPROTOOPT error.
> 
> 
> ----- Original Message -----
> From: bill lam <[email protected]>
> To: [email protected]
> Cc: 
> Sent: Tuesday, March 11, 2014 1:38:31 AM
> Subject: Re: [Jprogramming] sdcleanup_jsocket_ on osx
> 
> I didn't read jforc. You probably need a linger structure.
> 
> * 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx
> 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx
> Пн, 10 мар 2014, Pascal Jasmin писал(а):
>> I found some example code for SO_LINGER in JforC, but I don't know if it is 
>> outdated, or does not work for osx:
>> 
>> first the exact example:
>> 
>> sdcheck_jsocket_ sdsetsockopt 0, SOL_SOCKET_jsocket_,SO_LINGER_jsocket_, 1 66
>> 
>> fails due to length error 5 params for 4 expected.
>> 
>> but other attempts also fail including:
>> sdcheck_jsocket_ sdsetsockopt_jsocket_ 0, 
>> SOL_SOCKET_jsocket_,SO_LINGER_jsocket_, 1
>> 
>> sdcheck_jsocket_ sdsetsockopt_jsocket_ 0, 
>> SOL_SOCKET_jsocket_,SO_LINGER_jsocket_, 0
>> 
>> 
>> The latter corresponds to the value of sdgetsockopt.
>> 
>> There is exception handling code for SO_LINGER in set and get sockopt.  Is 
>> the issue I am having osx specific?
>> 
>> sdsetsockopt=: 3 : 0
>> 's lev name val'=. y
>> if. name -: SO_LINGER do. val=. 65536 65536#.val end.
>> rc0 setsockoptJ s;lev;name;(,val);4
>> )
>> 
>> 
>> 
>> there i
>> 
>> 
>> ----- Original Message -----
>> From: Pascal Jasmin <[email protected]>
>> To: "[email protected]" <[email protected]>
>> Cc: 
>> Sent: Monday, March 10, 2014 3:30:53 PM
>> Subject: Re: [Jprogramming] sdcleanup_jsocket_ on osx
>> 
>> thank you for pointing this out.
>> 
>> While trying to make a reset verb, I can't seem to set this option:
>> 
>> cocurrent 'jsocket'
>> 
>> sdreset =: 3 : 0
>> pD v=. sdcheck sdgetsockopt 0; SOL_SOCKET_jsocket_;SO_LINGER_jsocket_
>> pD sdcheck sdsetsockopt 0;SOL_SOCKET_jsocket_;SO_LINGER_jsocket_;  1 0
>> pD sdcleanup_jsocket_ ''
>> pD sdsetsockopt 0;SOL_SOCKET_jsocket_;SO_LINGER_jsocket_; v
>> )
>> 
>> 
>> The first line returns ,< 0 0
>> 
>> its not clear how to pass the shape component in the 2nd line, but at any 
>> rate, I generate EINVAL errors no matter what I try to pass in set option, 
>> including 0 0 or ,< 0 0.
>> 
>> Could you please help in how to call sdsetsockopt for SO_LINGER?
>> 
>> ----- Original Message -----
>> From: bill lam <[email protected]>
>> To: [email protected]
>> Cc: 
>> Sent: Monday, March 10, 2014 10:57:56 AM
>> Subject: Re: [Jprogramming] sdcleanup_jsocket_ on osx
>> 
>> This is socket linger timeout, a feature not a bug. you may set tcp option
>> to disable it but I guess it is there for a good reason.
>> On Mar 10, 2014 10:51 PM, "Pascal Jasmin" <[email protected]> wrote:
>> 
>>> actually, an idle loop doesn't always free up resources.  Though load
>>> 'socket' seems to reset it.
>>> 
>>> 
>>> ----- Original Message -----
>>> From: Pascal Jasmin <[email protected]>
>>> To: "[email protected]" <[email protected]>
>>> Cc:
>>> Sent: Monday, March 10, 2014 10:31:53 AM
>>> Subject: [Jprogramming] sdcleanup_jsocket_ on osx
>>> 
>>> sdcleanup_jsocket_ '' on windows will close all sockets correctly.  On
>>> OSX, it seems to require going to idle loop before any reuse of previous
>>> sockets (listen) is done.
>>> 
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> 
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> 
>>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> -- 
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to