harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Beyer" <nbe...@gmail.com>
Subject Re: svn commit: r721570 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main: java/java/net/ java/org/apache/harmony/luni/net/ java/org/apache/harmony/luni/platform/ native/luni/shared/ native/luni/unix/
Date Sat, 29 Nov 2008 18:59:05 GMT
I'm seeing a compile error in NIO's ServerSocketChannelImpl on line
90. It was calling INetworkSystem createServerSocketStream. I changed
to the only comparable method I could find - createStreamSocket.

I haven't checked this in yet, but I probably will in a bit once I
verify all compiles are successful.

-Nathan

On Fri, Nov 28, 2008 at 4:14 PM, Tim Ellison <t.p.ellison@gmail.com> wrote:
> I'm just sending this to the dev list for the record in case people want
> to recreate the logic I went through...
>
> tellison@apache.org wrote:
>> Log:
>> Remove multicast socket native call, and replace it with regular
>> datagram socket creation.
>> The main difference here is that the setting of SO_REUSEADDR will be
>> called for sockets created from a user defined datagram socket factory
>> (it wasn't previously).  Since we need the option set, this is a good
>> thing.
> <snip>
>> -            // the required default options are now set in the VM where they
>> -            // should be
>> +            impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.TRUE);
>
> I figured this out by creating a mock socket impl and seeing what calls
> were made on it from the RI, which were:
>
> constructor
> create
> setOption id: 4 val:true
> bind
>
>
> import java.io.IOException;
> import java.net.DatagramPacket;
> import java.net.DatagramSocket;
> import java.net.DatagramSocketImpl;
> import java.net.DatagramSocketImplFactory;
> import java.net.InetAddress;
> import java.net.MulticastSocket;
> import java.net.NetworkInterface;
> import java.net.SocketAddress;
> import java.net.SocketException;
>
> public class TestDGSocket {
>
>    private static class FakeSock extends DatagramSocketImpl {
>        public FakeSock() { System.out.println("constructor"); }
>        protected void bind(int lport, InetAddress laddr) throws
> SocketException { System.out.println("bind"); }
>        protected void close() { System.out.println("close"); }
>        protected void create() throws SocketException {
> System.out.println("create"); }
>        protected byte getTTL() throws IOException {
> System.out.println("getTTL"); return 0; }
>        protected int getTimeToLive() throws IOException {
> System.out.println("getTimeToLive"); return 0; }
>        protected void join(InetAddress inetaddr) throws IOException {
> System.out.println("join"); }
>        protected void joinGroup(SocketAddress mcastaddr,
> NetworkInterface netIf) throws IOException {
> System.out.println("joinGroup"); }
>        protected void leave(InetAddress inetaddr) throws IOException {
> System.out.println("leave"); }
>        protected void leaveGroup(SocketAddress mcastaddr,
> NetworkInterface netIf) throws IOException {
> System.out.println("leaveGroup"); }
>        protected int peek(InetAddress i) throws IOException {
> System.out.println("peek"); return 0; }
>        protected int peekData(DatagramPacket p) throws IOException {
> System.out.println("peekData"); return 0; }
>        protected void receive(DatagramPacket p) throws IOException {
> System.out.println("receive"); }
>        protected void send(DatagramPacket p) throws IOException {
> System.out.println("send"); }
>        protected void setTTL(byte ttl) throws IOException {
> System.out.println("setTTL"); }
>        protected void setTimeToLive(int ttl) throws IOException {
> System.out.println("setTimeToLive"); }
>        public Object getOption(int optID) throws SocketException {
> System.out.println("getOption"); return null; }
>        public void setOption(int optID, Object value) throws
> SocketException { System.out.println("setOption id: " + optID + " val:"
> + value); }
>    }
>
>    public static void main(String[] args) throws IOException {
>        DatagramSocketImplFactory factory = new
> DatagramSocketImplFactory() {
>            public DatagramSocketImpl createDatagramSocketImpl() {
>                return new FakeSock();
>            }
>        };
>        DatagramSocket.setDatagramSocketImplFactory(factory);
>        MulticastSocket s = new MulticastSocket();
>        System.out.println(s);
>    }
> }
>

Mime
View raw message