分类: 系统运维
2009-05-22 09:30:40
static int MyInt(unsigned char * p)
{
int a ;
((unsigned char *)&a)[0] = p[0] ;
((unsigned char *)&a)[1] = p[1] ;
((unsigned char *)&a)[2] = p[2] ;
((unsigned char *)&a)[3] = p[3] ;
return a ;
}
static short MyShort(unsigned char * p)
{
short a ;
((unsigned char *)&a)[0] = p[0] ;
((unsigned char *)&a)[1] = p[1] ;
return a ;
}
7.cmwap的http协议模拟
cmwap必须通过10.0.0.172:80端口进行代理
走http协议.一般是1.1
#define ProxyHttpRequestHeader "POST / HTTP/1.1\r\n" "X-Online-Host: \r\n" "Keep-Alive: close\r\n" "Content-Length: %d\r\n" "\r\n"
// X-Online-Host后面跟着的就是目标机器网络地址和端口
// Content-Length 后面填写随后的数据长度
// 头部后面跟着就是随后数据,最好使用base64编码.
// 服务器端收到数据一般经过移动网关修改.
8.cmwap的http模拟: 服务器端返回格式:
#define HTTP_RESPONSE_HEADER "HTTP/1.1 200 OK\r\n" "Content-Length: %d\r\n" "\r\n"
// Content-Length 后面填写随后的数据长度