Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bind several times to the same port in Mac OS X




Hey Tim, email@hidden

Tim's solution worked perfectly. He gave some C++ code
to turn on SO_REUSEADDR, here's the equivalent Java code:

        ServerSocketChannel channel = ServerSocketChannel.open();
        ServerSocket socket = channel.socket();
        socket.setReuseAddress(false);
        socket.bind(listenAddress);

This works perfectly. The second bind fails as expected.

It's simply a problem that the Mac JVM having a different default
reuseAddress value than the Windows and Linux JVMs.

Thanks again Tim!

Cheers,
Jesse Wilson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Bind several times to the same port in Mac OS X (From: Jesse Wilson <email@hidden>)
 >Re: Bind several times to the same port in Mac OS X (From: Dan Creswell <email@hidden>)
 >Re: Bind several times to the same port in Mac OS X (From: Jesse Wilson <email@hidden>)
 >Re: Bind several times to the same port in Mac OS X (From: Timothy Wall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.