FW: [jcifs] Problem reading from named pipe
Michael B Allen
mballen at erols.com
Fri Feb 15 07:36:49 EST 2002
On Thu, 14 Feb 2002 09:54:15 -0800
Sean Ryan <sryan at clear-tec.com> wrote:
> Mike,
>
> Thanks for your help. I think the speed is more of an issue with the server
> than the client, as I tried sending the same data with the callnp.exe
> utility and it's still slow, as it is when using the Win32 client from the
> code supplied by the vendor. The only issue I'm having now it trying to get
> multiple clients to access the server at the same time without screwing up.
> Using the example client code provided by the vendor it seems to work fine -
> adding a loop to the code to run the request/response code 10 times, and
> then running a number of the clients at the same time. But when I try the
> same in Java, some of the clients end up blocking on reading the response.
> It works if I serialize access to a single pipe, but aparently it is
> supposed to work without doing that.
I think you want to look into this "Overlapping" asynchronous IO business
in that Win32 example from your vendor:
hEventWrt = CreateEvent(NULL, TRUE, FALSE, NULL);
memset(&OverLapWrt, 0, sizeof(OverLapWrt));
OverLapWrt.hEvent = hEventWrt;
hEventRd = CreateEvent(NULL, TRUE, FALSE, NULL);
memset(&OverLapRd, 0, sizeof(OverLapRd));
OverLapRd.hEvent = hEventRd;
memset(TranBuf, 0, sizeof(TranBuf));
memset(RespBuf, 0, sizeof(RespBuf));
strcpy(TranBuf, TRAN_RECORD);
/* Write to the pipe. */
printf("Writing transaction: %s\n", TranBuf);
retCode = WriteFile(hPipe, TranBuf, strlen(TranBuf), &bytesWritten, &OverLapWrt);
I you *really* wanted to you could simulate what this is doing. But it
might mean looking at packet traces and wading through hexdumps...etc.
Glad to hear it's working for you though,
Mike
> On Wed, 13 Feb 2002 15:22:04 -0800
> Sean Ryan <sryan at clear-tec.com> wrote:
>
> > Mike,
> >
> > I changed my code to the following, and I do not get exceptions any more
> (it
> > is a bit slow though) :
>
> How slow? Pipes are not really fast. You should be able to at few dozen
> trasactions a second though. I don't really know. You would have to
> use a packet sniffer to see what's happening. There could be something
> timing out.
More information about the jcifs
mailing list