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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to