如何获得远程web服务器的时间? 比如我想获得yahoo的web服务器时间,如何实现?能不能写详细点?谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*;import java.net.*;public class GetDayTime{ public static void main(String args[]) { String host=args[0]; try { Socket connection=new Socket(host,13); System.out.println("Connection established: "); BufferedReader in=new BufferedReader( new InputStreamReader( connection.getInputStream())); String daytime=in.readLine(); System.out.println("day Time received: "+daytime); connection.close(); } catch(UnknownHostException uhe) { System.err.println("Unknown host: "+args[0]); } catch(IOException ioe) { System.err.println("IOException: "+ioe); } }}试试 这个行不 import java.io.*; import java.net.*; public class GetDayTime { public static void main(String args[]) { String host=args[0]; try { Socket connection=new Socket(host,13); System.out.println("Connection established: "); BufferedReader in=new BufferedReader( new InputStreamReader( connection.getInputStream())); String daytime=in.readLine(); System.out.println("day Time received: "+daytime); connection.close(); } catch(UnknownHostException uhe) { System.err.println("Unknown host: "+args[0]); } catch(IOException ioe) { System.err.println("IOException: "+ioe); } } } 关于泛型和迭代器 readbyte()怎么用?????????? 求教于高手 ? 请教 符号三角形 数组越界问题 MS IE浏览器自带的java虚拟机比sun的jre 缺少那些包的支持? 在jcreator中编译出现的问题 大虾快来(100分) 问一个简单问题?(如何获得和修改文件名) 同名内部类什么意思 求救“能用问卷调查系统”! 请问,JAVA与NET哪个容易学些? 安装不了JDK1.6
import java.net.*;
public class GetDayTime
{
public static void main(String args[])
{
String host=args[0];
try
{
Socket connection=new Socket(host,13);
System.out.println("Connection established: ");
BufferedReader in=new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String daytime=in.readLine();
System.out.println("day Time received: "+daytime);
connection.close();
}
catch(UnknownHostException uhe)
{ System.err.println("Unknown host: "+args[0]); }
catch(IOException ioe)
{ System.err.println("IOException: "+ioe); }
}
}
试试 这个行不
import java.net.*;
public class GetDayTime
{
public static void main(String args[])
{
String host=args[0];
try
{
Socket connection=new Socket(host,13);
System.out.println("Connection established: ");
BufferedReader in=new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String daytime=in.readLine();
System.out.println("day Time received: "+daytime);
connection.close();
}
catch(UnknownHostException uhe)
{ System.err.println("Unknown host: "+args[0]); }
catch(IOException ioe)
{ System.err.println("IOException: "+ioe); }
}
}