harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li" <liyilei1...@gmail.com>
Subject Re: [classlib][nio][discussion] Implementation of java.nio.channels.spi.SelectorProvider.inheritedChannel()
Date Mon, 24 Jul 2006 06:37:59 GMT
2006/7/13, Andrew Zhang <zhanghuangzhu@gmail.com>:
>
> Hello everybody,
>
> I plan to implement
> java.nio.channels.spi.SelectorProvider.inheritedChannel()
> method. Currently Harmony simply returns null.
>
> Spec doesn not specify how to detect inheritedChannel clearly, "Returns
> the
> channel inherited from the entity that created this Java virtual machine."
> "For example, on UNIX systems, the Internet services daemon (*inetd*) is
> used to start programs to service requests when a request arrives on an
> associated network port. In this example, the process that is started,
> inherits a channel representing a network socket. "
>
> As my understanding, what inherited channel does is redirect socket to
> standard input. Therefore, my solution looks like following:
>
> 1. get standard input file descriptor
> 2. assert the file descriptor. If it is a socket type descriptor, then
> returns a channel which wraps the descriptor.
>
> I also wrote some samples for ensuring my understanding. It seems OK on
> linux, but not the case on Window. RI always returns null on Windows
> (maybe
> because there is no service daemon program on Windows? or my understanding
> is totally wrong?) Therefore, I want to hear suggestions from our
> community,
> espeically folks experienced in network!
>
> Many thanks in advance!
>
> Best regards,
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
> Hi, Andrew:
    I have tried to redirect the stdin of a process to a socket/datagram on
windows. Although we can prove that the stdin is a normal
socket/datagram because it can be used to send data in Java as well, such as
using "System.out.println("XXX")" to send "XXX" to a client socket; but the
inheritedChannel on windows is always NULL.

Good luck!
-- 
Leo Li
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message