nanogui: question about GrOpen()..
Subject:
Re: question about GrOpen()..
From:
Gary James ####@####.####
Date:
1 Mar 2001 13:38:59 -0000
Message-Id: <20010301085211.A1470@pc.twcny.rr.com>
On Thu, 01 Mar 2001 10:30:35 niky wrote:
> > The solution I've used is to use GrOpen() check the
> > return value, and if OK, then call GrClose(). Afterwards,
> > you can then call GrOpen() again and it should work.
> > We made need to add a different open call sometime if
> > this doesn't work for you.
>
> I have tried to write a simple test. I use GrOpen () to connect to
> nano-X server, and then call GrClose () to disconnect. When I want to
> use GrOpen () to connect to server again, it will fail. My platform is
> microwin under X11.
>
The problem is in GrClose() in the client. Edit the file
".../microwin/src/nanox/client.c". Look for GrClose(), add the line
"nxSocket = -1;" to the end of the function. Then all will work well. ie:
CHANGE THIS:
void
GrClose(void)
{
#if GR_CLOSE_FIX
/* allow 1 second to flush*/
void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
alarm(1);
#endif
AllocReq(Close);
GrFlush();
#if GR_CLOSE_FIX
alarm(0);
signal(SIGALRM, oldSignalHandler);
#endif
close(nxSocket);
}
TO THIS:
void
GrClose(void)
{
#if GR_CLOSE_FIX
/* allow 1 second to flush*/
void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
alarm(1);
#endif
AllocReq(Close);
GrFlush();
#if GR_CLOSE_FIX
alarm(0);
signal(SIGALRM, oldSignalHandler);
#endif
close(nxSocket);
nxSocket = -1;
}
Gary James