用C socket http发送这段请求报文
HTTP分为请求行,请求头部以及请求内容
那个长度数字值就是请求内容的长度(字节为单位)
给一段例子你就基本明白了:
onst CString getString(int i)
{
CString s;
s.Format(_T("%d"), i);
return s;
}
////////////////////////////////
CString cnt;
CString psr;
cnt.Append(_T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"));
cnt.Append(_T("<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-
instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\r\n"));
cnt.Append(_T("<soap12:Body>\r\n"));
cnt.Append(_T("<CelsiusToFahrenheit xmlns=\"http://tempuri.org/\">\r\n"));
cnt.Append(_T("<Celsius>100</Celsius>\r\n"));
cnt.Append(_T("</CelsiusToFahrenheit>\r\n"));
cnt.Append(_T("</soap12:Body>\r\n"));
cnt.Append(_T("</soap12:Envelope>\r\n\r\n"));
psr.Append(_T("POST "));
psr.Append(_T("/webservices/tempconvert.asmx"));
psr.Append(_T(" HTTP/1.1\r\nHOST: "));
psr.Append(_T("www.w3schools.com"));
psr.Append(_T("\r\nContent-Type: application/soap+xml; charset=utf-8"));
&nb
相关文档:
C/S 与 B/S
1.硬件环境不同:
C/S 一般建立在专用的网络上, 小范围里的网络环境, 局域网之间再通过专门服务器提供连接和数据交换服务.
B/S 建立在广域网之上的, 不必是专门的网络硬件环境,例与电话上网, 租用设备. 信息自己管理. 有比C/S更强的适应范围, 一般只要有操作系统和浏览器就行&n ......
位和字节的重排在密码学算法中有广泛的应用。
/* rearran.c:位和字节的重排 */
/* 位反转:以字的中心为对称点进行位反射
例如: abcd efgh ijkl mnop ABCD EFGH IJKL MNOP
位反转:PONM LKJI HGFE DCBA ponm lkji hgfe dcba */
unsigned rev(unsigned x){
/* 交换相邻的单个位 */
x=(x & 0x5 ......
GCC 编译c程序的方法及过程解析
Justin.zp.Yang 2010.04.10
目前 Linux 下最常用的 C 语言编译器是 GCC ( GNU Compiler Collection ),它是 GNU 项目中符合 ANSI C 标准的编译系统,能够编译用 C 、 C++ 和 Object C 等语言编写的程序。 GCC 不仅功能非常强大,结构 ......
1、选择合适的算法和数据结构
选择一种合适的数据结构很重要,如果在一堆随机存放的数中使用了大量的插入和删除指令,那使用链表要快得多。数组与指针语句具有十分密切的关系,一般来说,指针比较灵活简洁,而数组则比较直观,容易理解。对于大部分的编译器,使用指针比使用数组生成的代码更短,执行效率更高。
在许多 ......