For details about HTTP, please refer to RFC2616
http://tools.ietf.org/html/rfc2616
2011/10/24 Zhangming Niu <niuzha...@gmail.com>:
> HTTP is just kind of special text format, like XML, but it is a special and
> well defined and widely used XML
--
Milo Yip
http://www.cnblogs.com/miloyip/
http://weibo.com/miloyip/
http://twitter.com/miloyip/
You may check a HTTP example from
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session
2011/10/24 Zhangming Niu <niuzha...@gmail.com>:
On 10月24日, 下午4时02分, sail tsao <sail.t...@gmail.com> wrote:
> 国外游戏喜欢使用UDP协议为主,为UDP添加一种模拟TCP的确保发送成功的机制,主要原因是国外喜欢制作实时性很强的游戏,TCP对于实时性强的游戏服务器 来说有弊端,tcp的原罪,在此就不细说了,所以国外用UDP的多。
> 国内因为制作的网游很多实时性不高,所以TCP为主。
> 除了tcp和udp以外,HTTP之流的协议的游戏服务器还真没见过,因为我实在想不出用HTTP的需求
>
> 在 2011年10月24日 下午3:48,Milo Yip <milo...@gmail.com>写道:
>
>
>
>
>
>
>
>
>
> > HTTP is NOT HTML... It is a transfer protocol, like FTP.
> > HTTP can be used to transfer any data, such as a JPEG image file.
>
> > For details about HTTP, please refer to RFC2616
> >http://tools.ietf.org/html/rfc2616
>
> > 2011/10/24 Zhangming Niu <niuzhangm...@gmail.com>:
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Etag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8
uint16_t contentLenth; //438uint16_t httpVersion;char responseCode[10];
uint16_t rCLength;// sometimes used};
send(socket, char *(&http), sizeof(Http), 0) // need to add validation stuff recv(socket, char *(&httpHeader_recv), sizeof(httpHeader_recv), 0)// need to add validation stuffuint16_t bodyLength = sizeof(httpHeader_recv.contentlength) ;
recv(socket, char *(&httpBody), bodyLength, 0)// need to add validation stuff