diff --git a/src/j3/Thttpd.java b/src/j3/Thttpd.java index 356d992..fece131 100644 --- a/src/j3/Thttpd.java +++ b/src/j3/Thttpd.java @@ -25,19 +25,20 @@ // その他 if (args.length == 0) // 引数がない場合、以下のファイルを返すことにする - args = new String[] { "src/j3/index.html" }; // 相対パスで指定。windowsの場合、user.dir=NWP + args = new String[] { "src/j3/index.html" ,"8000"}; // 相対パスで指定。windowsの場合、user.dir=NWP // args = new String[] { "j3/index.html" };//Linuxの場合、通常はcd NWP/src しているはず System.out.println("このサーバは" + args[0] + "を返します。"); System.out.println(System.getProperty("user.dir")); + int portnum = Integer.parseInt(args[1]); try { - // サーバ用ソケットの作成(ポート番号8000番) - servsock = new ServerSocket(8000); + // サーバ用ソケットの作成(デフォルトでは、ポート番号8000番) + servsock = new ServerSocket(portnum); while (true) { sock = servsock.accept();// 接続要求の受付 new RequestHandler(sock, args[0]); } } catch (IOException e) { - System.out.println("異常終了:ポート番号の重複の可能性あり"); + System.out.println("異常終了:ポート番号("+portnum+")がすでに使われているようです"); System.exit(1); // 異常終了は1 } } diff --git a/src/j3/index.html b/src/j3/index.html index b306dba..b3ecf5b 100644 --- a/src/j3/index.html +++ b/src/j3/index.html @@ -8,9 +8,9 @@

Motoki Miura

- 三浦のWebサイト + src.html
-
+ 三浦のWebサイト