一个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)
//
#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)
相关文章推荐
- 请使用socket相关函数(非curl)实现如下功能:构造一个post请求,发送到指定httpserver的指定端口的指定请求路径(如http://www.example.com:8080/test)
- C/C++实现HTTP/HTTPS的POST存在的问题
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- 给定一个字符串实现对字符串左移或右移指定长度
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- C++ 实现 发送HTTP Get/Post请求 good
- 我发起一个http url,本地没问题,发布到测试环境后,报错post 400 bad request,原来是测试的tomcat版本比较高,它对post的长度做了限制。
- c++ 实现 http get post 请求
- C++实现Http Post请求
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- 开源一个C++实现的简单HTTP协议处理库
- linux下HttpGet、HttpPost的C++实现
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- C++ 简单实现HTTP GET/POST 请求
- C++ 简单实现HTTP GET/POST 请求
- 关于udp socket recvfrom函数的一个易错问题: 如果应用程序指定的接收长度不够怎么办?
- 关于 HTTP GET/POST 请求参数长度最大值的一个理解误区
- linux下HttpGet、HttpPost的C++实现
- 一个linux下简单的纯C++实现Http请求类(GET,POST,上传,下载)