[Win32utils-devel] Asynchronous Pipe::Server problems

Daniel Berger djberg96 at gmail.com
Tue May 20 00:39:27 EDT 2008


Heesob Park wrote:
> Hi,
> 
> 2008/5/20 Daniel Berger <djberg96 at gmail.com>:
>> Hi all,
>>
>> I've been working on the win32-pipe library (again) and I've reworked the
>> interface. Instead of Pipe.new_server or Pipe.new_client, there's now a base
>> Pipe class, with Pipe::Server and Pipe::Client subclasses. You can find the
>> latest code in the CVS repo.
>>
>> Oh, and you'll need to update your windows-pr library with the latest from
>> CVS if you want to use this. I had to add some missing pipe related error
>> constants to the Windows::Pipe module. These will be included in windows-pr
>> 0.8.5.
>>
>> Anyway, I've got the synchronous mode working alright. Unfortunately, I
>> can't get the asynchronous server to work. When I try to run the
>> test_server_async.rb code (in CVS) I get this:
>>
>> VERSION: 0.2.0
>> win32-pipe/lib/win32/pipe/server.rb:69:in `connect': Waiting for a
>> process to open the other end of the pipe. (Win32::Pipe::Error)
>> from test_server_async.rb:70:in `mainloop'
>> from test_server_async.rb:101
>>
>> Any ideas?
>>
> Because ERROR_PIPE_LISTENING (536) is not an actual error, just ignore
> it like this:
> 
>             case error
>                when ERROR_IO_PENDING
>                   @pending_io = true
>                when ERROR_PIPE_CONNECTED
>                   unless SetEvent(@handle)
>                      raise Error, get_last_error(error)
>                   end
>                when ERROR_PIPE_LISTENING
>                   # do nothing
>                else
>                   raise Error, get_last_error(error)
>             end

Ah, that definitely improved things, thanks. I also fixed up the 
test_client_async.rb script, btw.

However, I've botched something else up. I started up the 
test_async_server.rb program in one terminal, then ran the 
test_client_async.rb program. The first time it works on the client side:

# Client side
Connected...
write_complete
pipe client is running
read_complete
Got [Ruby rocks!] back from server

Though I see nothing on the server side.

The second time I run the client it just hangs.

I fixed something in the Pipe#wait method (so update from CVS) but that 
didn't solve it.

Any ideas?

Thanks,

Dan


More information about the win32utils-devel mailing list