=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/sio.c,v retrieving revision 1.5 retrieving revision 1.11 diff -u -p -r1.5 -r1.11 --- OpenXM_contrib2/asir2000/io/sio.c 2000/08/21 08:31:39 1.5 +++ OpenXM_contrib2/asir2000/io/sio.c 2000/12/05 01:24:55 1.11 @@ -23,7 +23,7 @@ * shall be made on your publication or presentation in any form of the * results obtained by use of the SOFTWARE. * (4) In the event that you modify the SOFTWARE, you shall notify FLL by - * e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification + * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification * for such modification or the source code of the modified part of the * SOFTWARE. * @@ -44,14 +44,13 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/sio.c,v 1.4 2000/07/13 05:09:02 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/sio.c,v 1.10 2000/11/15 01:20:27 noro Exp $ */ -#if INET #include "ca.h" #include "setjmp.h" #include "ox.h" #if defined(VISUAL) -#include +#include #else #include #include @@ -65,6 +64,7 @@ extern int little_endian; +int I_am_server; struct IOFP iofp[MAXIOFP]; #if !defined(_PA_RISC1_1) @@ -107,11 +107,14 @@ char *port_str; unsigned int port; static int count=0; +#if !defined(VISUAL) if ( use_unix ) { sprintf(port_str,"/tmp/ox%02x.XXXXXX",count); count++; mktemp(port_str); - } else { + } else +#endif + { port = ((unsigned int)mt_genrand()+(unsigned int)get_current_time()) %(65536-1024)+1024; sprintf(port_str,"%d",port); @@ -282,6 +285,7 @@ char *host,*port_str; return s; } +#if 0 close_allconnections() { int s; @@ -305,6 +309,12 @@ int s; free_iofp(s); } } +#else +close_allconnections() +{ + shutdown_all(); +} +#endif free_iofp(s) int s; @@ -368,6 +378,9 @@ int is_server; } else { /* client : read -> write */ read_char(iofp[i].in,&rc); + /* special care for a failure of spawing a server */ + if ( rc !=0 && rc != 1 && rc != 0xff ) + return -1; write_char(iofp[i].out,&c); ox_flush_stream_force(i); } iofp[i].conv = c == rc ? 0 : 1; @@ -413,4 +426,4 @@ int fd; return i; return -1; } -#endif /* INET */ +