小编roh*_*hit的帖子

Java:套接字编程示例

以下程序从时间服务器获取时间有什么问题.

public class SocketTest
{  
    public static void main(String[] args)
    {
         Socket s = new Socket(“time-A.timefreq.bldrdoc.gov”, 13);
          BufferedReader in = new BufferedReader(
                  new InputStreamReader(s.getInputStream()));
       String line;
       do
       {    line = in.readLine();  //read line of text from socket
              if (line != null)  System.out.println(line);
       }
       while(line != null);
    }

}
Run Code Online (Sandbox Code Playgroud)

java sockets quotes network-programming compiler-errors

2
推荐指数
1
解决办法
4526
查看次数