@@ -148,8 +148,8 @@ public static int Main (string[] args)
148148
149149 bool help = false ;
150150 bool verbose = false ;
151- string address = null ;
152- string port = null ;
151+ IPAddress ipAddress = IPAddress . Any ;
152+ ushort port = 0 ;
153153 string log_path = "." ;
154154 string log_file = null ;
155155 string launchdev = null ;
@@ -165,9 +165,9 @@ public static int Main (string[] args)
165165 var os = new OptionSet ( ) {
166166 { "h|?|help" , "Display help" , v => help = true } ,
167167 { "verbose" , "Display verbose output" , v => verbose = true } ,
168- { "ip" , "IP address to listen (default: Any)" , v => address = v } ,
169- { "port" , "TCP port to listen (default: Any)" , v => port = v } ,
170- { "logpath" , "Path to save the log files (default: .)" , v => log_path = v } ,
168+ { "ip= " , "IP address to listen (default: Any)" , v => ipAddress = IPAddress . Parse ( v ) } ,
169+ { "port= " , "TCP port to listen (default: Any)" , v => port = ushort . Parse ( v ) } ,
170+ { "logpath= " , "Path to save the log files (default: .)" , v => log_path = v } ,
171171 { "logfile=" , "Filename to save the log to (default: automatically generated)" , v => log_file = v } ,
172172 { "launchdev=" , "Run the specified app on a device (specify using bundle identifier)" , v => launchdev = v } ,
173173 { "launchsim=" , "Run the specified app on the simulator (specify using path to *.app directory)" , v => launchsim = v } ,
@@ -187,14 +187,8 @@ public static int Main (string[] args)
187187
188188 var listener = new SimpleListener ( ) ;
189189
190- IPAddress ip ;
191- if ( String . IsNullOrEmpty ( address ) || ! IPAddress . TryParse ( address , out ip ) )
192- listener . Address = IPAddress . Any ;
193-
194- ushort p ;
195- if ( UInt16 . TryParse ( port , out p ) )
196- listener . Port = p ;
197-
190+ listener . Address = ipAddress ;
191+ listener . Port = port ;
198192 listener . LogPath = log_path ?? "." ;
199193 listener . LogFile = log_file ;
200194 listener . AutoExit = autoexit ;
@@ -402,4 +396,4 @@ static string Quote (string f)
402396
403397 [ DllImport ( "libc" ) ]
404398 private static extern void kill ( int pid , int sig ) ;
405- }
399+ }
0 commit comments