[Win32utils-devel] Asynchronous Pipe::Server problems

Berger, Daniel Daniel.Berger at qwest.com
Tue May 20 11:41:50 EDT 2008


 
Hi,

<snip>

> >> The problem is due to the reconnect method.  
> >> The solution is define disconnect as DisconnectNamedPipe 
> >> ,close as before
> >> and modify 
> >> 
> >>    def reconnect
> >>       close
> >>       mainloop
> >>    end
> >> 
> >> to
> >> 
> >>    def reconnect
> >>       disconnect
> >>       mainloop
> >>    end
> > 
> > Just to clarify, we want this in pipe.rb then?
> >
> Yes, of course.
>  
> > def disconnect
> >   DisconnectNamedPipe(@pipe)
> > end
> > 
> > def close
> >   CloseHandle(@pipe)
> > end
> >
> close on server.rb could be
> 
> def close
>   FlushFileBuffers(@pipe)
>   DisconnectNamedPipe(@pipe)
>   CloseHandle(@pipe)
> end

Ok, I made these changes, and added the begin/ensure for a block form
(which you can find in CVS). But, I've botched something up in the
asynchronous server again (sorry!). I fired up the async server and
connected with the async client and this happened.

C:\Documents and Settings\djberge\workspace\win32-pipe>ruby -Ilib
-Ilib/win32 examples\test_server_async.rb
VERSION: 0.2.0
pipe server is running
pipe server is running
connected
read_complete
Got [Ruby rocks!]
pipe server is running
write_complete
pipe server is running
./lib/win32/pipe/server.rb:68:in `connect': The handle is invalid.
(Win32::Pipe::Error)
        from examples/test_server_async.rb:67:in `mainloop'
        from examples/test_server_async.rb:97
        from ./lib/win32/pipe/server.rb:35:in `initialize'
        from examples/test_server_async.rb:96:in `new'
        from examples/test_server_async.rb:96

So, somehow the server is calling close unexpectedly. I don't think it's
the begin/ensure code, because even after removing that I get the same
behavior.

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.


More information about the win32utils-devel mailing list