[Title]change socket to serversocket
authormunkyu.im <munkyu.im@samsung.com>
Fri, 16 Mar 2012 04:57:29 +0000 (13:57 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Fri, 16 Mar 2012 04:57:29 +0000 (13:57 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

src/org/tizen/emulator/manager/tool/Launcher.java
src/org/tizen/emulator/manager/tool/PortHelper.java

index 313c980..fd2732f 100644 (file)
@@ -53,8 +53,12 @@ public class Launcher {
                        } catch (IOException e) {
                                // means portNo not in use
                                MessageBox alert = new MessageBox(shell, SWT.OK);
-                               alert.setMessage("Can not start the target: " + property.getName() +"\nVirtual target with the same name is running now!"
-                                               + "If not, delete port info file: " + PortPath);
+                               alert.setMessage("Can not launch this target: " + property.getName()
+                                               + "\n※ Predictable Causes are below."
+                                               +"\n1. Virtual target with the same name is running now."
+                                               + "\n2. Emulator might be terminated abnormally before."
+                                               + "\nIf case 1, exit existing virtual target and re-launch."
+                                               + "\nIf case 2, delete the port info file: " + PortPath);
                                alert.open();
                                return;
                        }
@@ -171,7 +175,7 @@ public class Launcher {
                                pb3.start();
                        }
                        cmd.add("-serial");
-                       cmd.add("file:emulator.klog");
+                       cmd.add("file:" + EmulatorVMs.getInstance().getVMsBaseDirectory() + File.separator  +property.getArch().toString() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
                        cmd.add("-m");
                        cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
                        cmd.add("-M");
index 9eb5e5c..b9c6539 100644 (file)
@@ -1,23 +1,22 @@
 package org.tizen.emulator.manager.tool;
 
 import java.io.IOException;
+import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.UnknownHostException;
 
 public class PortHelper {
-       Socket so;
+       ServerSocket so;
        public int getPortNo()
        {
                int port;
                for(port=26100;port < 26200; port += 10) {
                        try {
-                               so = new Socket("localhost", port+1);
-                       } catch (UnknownHostException e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
+                               so = new ServerSocket(port+1);
+                               return port;
                        } catch (IOException e) {
                                // TODO Auto-generated catch block
-                               return port;
+                       continue;
                        }
                }
                return -1;