java io笔记
File.separatorChar 返回一个字符,表示当前系统默认的文件名分隔符,在Windows中为"\",unix中为"/"。File.separator 与前者相同,但将分隔符作为字符串类型返回。pathSeparatorChar 返回一个字符,表示当前系统默认的路径名分隔符,在Windows中为";",unix中为":"。File.pathSeparator...
View Article网络协议笔记
OSI是一个开放性的通行系统互连参考模型,他是一个定义的非常好的协议规范。OSI模型有7层结构,每层都可以有几个子层。OSI七层模型是一个很好的理论模型,但是在实际应用中都做了裁剪。尤其是TCP/IP的盛行,把7层结构压成了4层,所以很多人都批评OSI七层模型过于复杂,但是作为一个完整的全面的网络模型,还是被大家非常认可的。OSI的7层从上到下分别是应用层、表示层、会话层、传输层、网络层、数据链路层...
View ArticleHttpURLConnection设置网络超时
Java中可以使用HttpURLConnection来请求WEB资源。HttpURLConnection对象不能直接构造,需要通过 URL.openConnection()来获得HttpURLConnection对象,示例代码如下:String urlStr= www.ttt.org;URL url = new URL(urlStr);HttpURLConnection conn =...
View ArticleHttpURLConnection timeout solution
From: Niels Campbell (niels_campbell_at_lycos.co.uk)Date: 01/23/04Date: 23 Jan 2004 09:14:16 -0800After spending nearly 3 days on this problem to come up with a solution I think it is only right to...
View ArticleAdding Socket Timeout to java.net.URLConnection (JDK 1.2)
Adding Socket Timeout to java.net.URLConnection (JDK 1.2) found a bug , see "connected = true;" in public void connect() throws IOException { Note: 05/11/01 Sam Found a patch for borland As I got the...
View Article