如何获得远程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); } } } 如何能打开jsp就直接执行action 一个好的地址!!不容错过啊! jsp中SQL语句引用变量的详细语法 java 中的 ^ 是什么意思? 求 weblogic7下载地址 for linux JAVA 读文本的问题 内存数据库的问题,解决了就给分100 我再用jbuilder6可是为什么光标总是会在输入得前两个位置阿 菜鸟弱问GUI 问题!和Jframe 有关 关于文件处理 请问,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); }
}
}