Welcom to RO_wsy's blog

上一页 1 2 3 4 5 6 7 ··· 11 下一页
摘要: http请求消息:一个请求行若干消息头实体内容http响应消息:一个状态行若干消息头实体内容注意: 消息头和实体内容之间有一个空行 消息头大小写不敏感 消息头冒号后有一个空格 get请求不包含实体内容几个消息头:Connection 用于指定处理完本次请求之后,客户端与服务器是否继续保持连接,设置值可以为Keep-Alive和close,http1.1默认为Keep-AliveAccept-Language 用于指出客户端希望服务器返回的文档所使用的国家语言,可以指定多个一逗号分隔的国家语言Content-Length 用于表示实体内容的长度(字节)Range 用于指定服务器只需返回文档中的部 阅读全文
posted @ 2012-11-23 11:00 RO_wsy 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 客户端代码如下:import java.net.*;import java.io.*;public class ObjectClient { public static void main(String[] args) { try { Socket s = new Socket("127.0.0.1", 8001); // 实际编程不要写死 InputStream is = s.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); Student stu = (Student)oi... 阅读全文
posted @ 2012-11-23 10:18 RO_wsy 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 检测:用netstat -na命令可以查看哪些端口正在被监听解决:用一个配置参数指定tcp程序所使用的端口号 阅读全文
posted @ 2012-11-23 09:46 RO_wsy 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 程序 ==> 控制面板 ==> 程序和功能 ==> 打开或关闭Windows功能点选telnet客户端 阅读全文
posted @ 2012-11-23 09:38 RO_wsy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: tcp服务器代码如下:import java.net.*;public class ReserveServer { public static void main(String[] args) { // 用户可自行指定端口号 try { ServerSocket ss; if (args.length < 1) { ss = new ServerSocket(8888); } else { ss = new ServerSocket(Integer.parseInt(args[0])); } while (true) { Socket s =... 阅读全文
posted @ 2012-11-23 09:35 RO_wsy 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 发送者类如下:import java.net.*;public class UdpSender { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { DatagramSocket ds = new DatagramSocket(); String info = "hello snooker 中国"; ds.send(new DatagramPacket(info.getBytes(), info.getBytes(... 阅读全文
posted @ 2012-11-22 15:48 RO_wsy 阅读(193) 评论(0) 推荐(0) 编辑
摘要: import java.io.*;public class Serialization { public static void main(String [] args) { Student stu1 = new Student(1, "Ronnie", 37, "snooker"); Student stu2 = new Student(2, "John", 37, "snooker"); try { ObjectOutputStream os = new ObjectOutputStream(new FileO 阅读全文
posted @ 2012-11-21 21:47 RO_wsy 阅读(334) 评论(0) 推荐(0) 编辑
摘要: import java.io.*;public class DataStreamTest { public static void main(String [] args) { try { FileOutputStream fos = new FileOutputStream("count.txt"); BufferedOutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos); dos.writeUTF("ab中国" 阅读全文
posted @ 2012-11-21 21:26 RO_wsy 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 72、EJB的角色和三个对象 一个完整的基于EJB的分布式计算结构由六个角色组成,这六个角色可以由不同的开发商提供,每个角色所作的工作必须遵循Sun公司提供的EJB规范,以保证彼此之间的兼容性。这六个角色分别是EJB组件开发者(Enterprise Bean Provider) 、应用组合者(Application Assembler)、部署者(Deployer)、EJB 服务器提供者(EJB Server Provider)、EJB 容器提供者(EJB Container Provider)、系统管理员(System Administrator)三个对象是Remote(Local)接口、Ho 阅读全文
posted @ 2012-11-21 14:37 RO_wsy 阅读(203) 评论(0) 推荐(0) 编辑
摘要: ByteArrayInputStream和ByteArrayOutputStream,用于以IO流的方式来完成对字节数组内容的读写,来支持类似内存虚拟文件或者内存映射文件的功能实例:import java.io.*;public class ByteArrayStreamTest { public static void main(String [] args) { String str = "abcdef"; ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes()); ByteArrayOutpu 阅读全文
posted @ 2012-11-21 14:33 RO_wsy 阅读(285) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 11 下一页