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 02:02:28 GMT
2006/7/24, Jimmy, Jing Lv <firepure@gmail.com>:
>
> Andrew Zhang wrote:
> > 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.
> >
>
> Hi Andrew:
>
>     I believe it is correct behavior Harmony should follow. What's
> more, it is necessary to detect Socket type, especially socket and
> ServerSocket (luckily datagram is easy to tell).
>     There are two states of socket, bound and connected. In semantic,
> one socket that is bound and not connected should be wrapped as
> ServerSocket, and wrapped as Socket if connected. So how to wrap a
> socket that is not bound nor connected? It seems we need a test then. :)
>
> > 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!
>
> Interesting, seems Bill Gates forgets inetd? :)
>
> >
> > Many thanks in advance!
> >
> > Best regards,
> >
>
>
> --
>
> Best Regards!
>
> Jimmy, Jing Lv
> China Software Development Lab, IBM
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>
Hi, Jimmy:
    It is right. According to my tests on Linux, if stdin is redirected to a
socket that is SOCK_STREAM and is connected, the inheritedChannel gets a
SocketChannel; if  it is SOCK_STREAM  and is not connected, the
inheritedChannel gets a ServerSocketChannel.

-- 
Leo Li
China Software Development Lab, IBM

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