您的位置:首页 > 理论基础 > 计算机网络

一个HTTP.二进制POST和HTTP指定长度接收的C++实现

2007-08-13 09:02 1121 查看
// CppSocket.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <iterator>
#include <Winsock2.h>

using namespace std;
#define MS_SOCKET 1

#ifdef MS_SOCKET
#define NULLCHAR
#define userlog printf
#endif
int FindContentLength(string header);
int RecvHttpHeader(int socket, string& header);
int RecvHttpBody(int socket, string& body, int contentLength);
long Post(const char * RemoteHostIP,int RemoteHostPort,const char *lpURL,const char *lpExtraHeaderInfo,string &strRecvBuf);

int _tmain(int argc, char* argv[])

long Post(const char * RemoteHostIP,int RemoteHostPort,const char *lpURL,const char *lpExtraHeaderInfo,string &strRecvBuf)

int FindContentLength(string header)

int RecvHttpHeader(int socket, string& header)

int RecvHttpBody(int socket, string& body, int contentLength)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: