Socket.st
changeset 2818 94d67df5c00d
parent 2773 ab3049f4a351
child 2823 10179ccfae5d
equal deleted inserted replaced
2817:61c6e819c1c1 2818:94d67df5c00d
    26 
    26 
    27 #include "stxOSDefs.h"
    27 #include "stxOSDefs.h"
    28 
    28 
    29 #ifdef WIN32
    29 #ifdef WIN32
    30 
    30 
       
    31 /* this is to catch uses of those - there should be none */
    31 # undef __BEGIN_INTERRUPTABLE__
    32 # undef __BEGIN_INTERRUPTABLE__
    32 # undef __END_INTERRUPTABLE__
    33 # undef __END_INTERRUPTABLE__
    33 # define __BEGIN_INTERRUPTABLE__ ..
    34 # ifdef __TCC__
    34 # define __END_INTERRUPTABLE__ ..
    35 #  define __BEGIN_INTERRUPTABLE__ xxxx
       
    36 #  define __END_INTERRUPTABLE__ yyyy
       
    37 # else
       
    38 #  define __BEGIN_INTERRUPTABLE__ ..
       
    39 #  define __END_INTERRUPTABLE__ ..
       
    40 # endif
    35 
    41 
    36 # define WRAP_STDIO
    42 # define WRAP_STDIO
    37 # define SET_LINGER_WHEN_CREATING_SOCKET
    43 # define SET_LINGER_WHEN_CREATING_SOCKET
    38 
    44 
    39 /*
    45 /*
    66 
    72 
    67 #include <stdio.h>
    73 #include <stdio.h>
    68 #include <errno.h>
    74 #include <errno.h>
    69 
    75 
    70 #ifdef WIN32
    76 #ifdef WIN32
    71 # ifndef __VISUALC__
    77 # ifdef __BORLANDC__
    72 #  include <Ws2tcpip.h>
    78 #  include <Ws2tcpip.h>
    73 # endif
    79 # endif
    74 #else
    80 #else
    75 # include <netinet/ip.h>
    81 # include <netinet/ip.h>
    76 #endif
    82 #endif
  2993     handle isNil ifTrue:[
  2999     handle isNil ifTrue:[
  2994 	^ self errorNotOpen
  3000 	^ self errorNotOpen
  2995     ].
  3001     ].
  2996 
  3002 
  2997 %{  /* STACK: 32000 */
  3003 %{  /* STACK: 32000 */
       
  3004 #ifndef NO_SOCKET
  2998     OBJ fp = __INST(handle);
  3005     OBJ fp = __INST(handle);
  2999 
  3006 
  3000     if (fp != nil) {
  3007     if (fp != nil) {
  3001 	SOCKET sock;
  3008 	SOCKET sock;
  3002 	int opt = -1;
  3009 	int opt = -1;
  3204 	if (usize == -1) goto argError;
  3211 	if (usize == -1) goto argError;
  3205 
  3212 
  3206 	ok = ( setsockopt( sock, level, opt, &u, usize) >= 0) ? true : false;
  3213 	ok = ( setsockopt( sock, level, opt, &u, usize) >= 0) ? true : false;
  3207     }
  3214     }
  3208 argError: ;
  3215 argError: ;
  3209 
  3216 #endif /* NO_SOCKET */
  3210 %}.
  3217 %}.
  3211     ok isNil ifTrue:[
  3218     ok isNil ifTrue:[
  3212 	self primitiveFailed
  3219 	self primitiveFailed
  3213     ].
  3220     ].
  3214     ok ifFalse:[
  3221     ok ifFalse:[
  4008 ! !
  4015 ! !
  4009 
  4016 
  4010 !Socket class methodsFor:'documentation'!
  4017 !Socket class methodsFor:'documentation'!
  4011 
  4018 
  4012 version
  4019 version
  4013     ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.268 2012-08-05 16:19:07 cg Exp $'
  4020     ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.269 2012-09-03 20:23:42 cg Exp $'
  4014 !
  4021 !
  4015 
  4022 
  4016 version_CVS
  4023 version_CVS
  4017     ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.268 2012-08-05 16:19:07 cg Exp $'
  4024     ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.269 2012-09-03 20:23:42 cg Exp $'
  4018 ! !
  4025 ! !