socket, nio socket,及xml传递object 方法
1:如何通过socket代理来访问服务端:
String proxyHost =
"192.168.204.212"
;
String proxyPort =
"1080"
;
//通知Java要通过代理进行连接。
正在装载数据……
System.getProperties().put(
"socksProxySet"
,
"true"
);
//指定代理所在的机器
System.getProperties().put(
"socksProxyHost"
,proxyHost);
//指定代理监听的端口。
System.getProperties().put(
"socksProxyPort"
,proxyPort);
String host =
"134.01.69.80"
;
int
port =
12086
;
System.out.println(
"connetioning:"
+ host +
":"
+ port);
server =
new
Socket(host, port);
二:老socket传递Object对象:
要传递的对象:
public
class
Employee
implements
Serializable {
private
int
employeeNumber;
private
String employeeName;
Employee(
int
num, String name) {
employeeNumber = num;
employeeName= name;
}
public
int
getEmployeeNumber() {
相关文档:
StringBuilder output = new
StringBuilder();
String xmlString =
@"<bookstore>
<book genre='novel' ISBN='10-861003-324'>
<title>The Handmaid's Tale</title>
<price>19.95</price>
</book>
<book genre='novel' ISBN='1-861001-57-5' ......
原文链接:http://www.cnblogs.com/ding0910/archive/2007/07/12/815407.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using BX.Interface;
......
XML Schema 中 import 和 include 的区别
XML Schema 允许将一个XSD文件分为几个文件存放,在必要时使用 import 或者 include 进行导入。这二者的区别是:
import:只能导入不同命名空间的XSD
include:只能导入相同命名空间的XSD,或被导入的XSD未声明命名空间
例子:
<xsd:import namespace=”http://acme ......
public static IList<News> GetAllNews()
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load("你读取的地址:例如 ......