functionality of Socket>>socketError

John M McIntosh johnmci at smalltalkconsulting.com
Wed Aug 25 04:58:43 UTC 2004


I'll be the first to say this is all a bit ill defined. You really need  
to check the C source code for the socket support code to understand  
what is  happening.
For os-x on or after the carbon VM 3.5.1b2 we switched to the Unix BSD  
socket code. The socketError primitive returns the results of capturing  
errno, or
  getsockopt(s, SOL_SOCKET, SO_ERROR, (void *)&error, &errsz) depending  
on what is happening at the time. This all assumes us VM folks capture  
the error data and don't have multiple calls trashing things (accept  
processing comes to mind).

Really one needs to review the C source code for the called primitive  
at the time of the error is required to understand where the data comes  
from.

On the other hand, sticking some documentation in the  
Socket>>socketError could be useful.

in errno.h we find
#define ECONNREFUSED    61              /* Connection refused */
That seems like a reasonable error, base on the fact we see that errno  
when the connection request fails.

FYI pre VM 3.5.1b2 the Open Transport code would return either

  kENOTCONNErr                  = -3256, /* Socket is not connected       
     */
or one of another 74 numbers from MacErrors.h
I'd think you would get
  kECONNREFUSEDErr       = -3260, /* Connection refused           */

I see that the window source which btw now has the three semaphore  
support  (Yah...)

Dated: *   RCSID:   $Id: sqWin32NewNet.c,v 1.9 2004/01/19 22:25:51  
andreasraab Exp $

It calls WSAGetLastError() from time to time to collect the error  
information.
However I suspect you'll need to confirm which windows VM you are  
using, then backtrack to the source code to see
if having zero is the expected results....


On Aug 24, 2004, at 5:50 PM, Frank Caggiano wrote:

>
> On Aug 24, 2004, at 3:35 PM, Kamil Kukura wrote:
>
>> I'm investigating if Socket>>socketError is usable for anything.  
>> Could someone try this on Linux or MacOS:
>>
>>    s _ Socket new.
>>    s connectNonBlockingTo: #(127 0 0 1) asByteArray port: 12345.
>>
>> and then print
>>
>>    s socketError
>>
>> on Windows (WinXP) I'm still getting zero.
>>
>> --  
>> Kamil
>>
>>
>>
>
> On Mac OSX vm 3.7.4b1 I get 61.
>
> Frank
>
>
>
>
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list