Author: nextgens
Date: 2007-04-26 16:50:31 +0000 (Thu, 26 Apr 2007)
New Revision: 12991

Modified:
   trunk/apps/new_installer/src/BindTest.java
Log:
new_installer: macos sets SOREUSEADDRESS when it opens a socket, contrary to 
other OSes ... we need to handle that to solve #1329

Modified: trunk/apps/new_installer/src/BindTest.java
===================================================================
--- trunk/apps/new_installer/src/BindTest.java  2007-04-26 16:40:18 UTC (rev 
12990)
+++ trunk/apps/new_installer/src/BindTest.java  2007-04-26 16:50:31 UTC (rev 
12991)
@@ -1,3 +1,4 @@
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
@@ -11,8 +12,12 @@
        public static void main(String[] args) {
                try{
                        Integer port = Integer.valueOf(args[0]);
-                       ServerSocket ss = new ServerSocket(port.intValue());
+                       ServerSocket ss = new ServerSocket();
+                       ss.setReuseAddress(false);
                        ss.setSoTimeout(200);
+                       ss.bind(new InetSocketAddress("127.0.0.1:", 
port.intValue()));
+                       if(!ss.isBound())
+                               System.exit(1);
                        ss.accept();
                }catch (SocketTimeoutException ste){
                }catch (SocketException e){


Reply via email to