プロが教えるわが家の防犯対策術!

javaを勉強しています。
echoサーバをつかったサンプルがあり、vinelinux上でコンパイリし実行したのですが、ioexceptionの例外が出ているようです。
echoサーバは動いていないのでしょうか??
echoサーバが動いているかどうか確認する方法はないですか?
このようなプログラムです。

import java.io.*;
import java.net.*;

public class EchoClient{
public static void main(String args[])throws IOException{
Socket echoS = null;
BufferedReader in = null;
PrintStream out = null;
try{
echoS = new Socket("1300",7);
in = new BufferedReader(new InputStreamReader(echoS.getInputStream()));
out = new PrintStream(echoS.getOutputStream());
}catch(UnknownHostException e){
System.out.println("ホストに接続できません");
System.exit(1);
}catch(IOException e){
System.out.println("ioコネクションを得られません");
System.exit(1);
}
BufferedReader stdln = new BufferedReader(new InputStreamReader(System.in));
String typedString;

while((typedString = stdln.readLine()) != null){
out.println(typedString);
System.out.println("サーバーからのエコー" + in.readLine());
}
in.close();
out.close();
stdln.close();
echoS.close();
}
}

A 回答 (1件)

telnet 1300 7


で接続できるか、なんてのはどうですか。

この回答への補足

だめでした・・・・

動いてないみたいです

補足日時:2003/07/29 22:45
    • good
    • 0
この回答へのお礼

早速やってみますね!

お礼日時:2003/06/26 18:18

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!