如题,如何实现用HTTP协议向某台机子(A机:192.168.2.153)的harddisk目录下传送文件。。A机的用户名和密码都为admin
解决方案 »
- TRACKMOUSEEVENT //的使用是当鼠标离开时;不启用跟踪光标呀???
- 急!求解MFC 的picture control 控件
- 请教一个类与类之间的变量调用问题
- VC中串口编程问题
- 如何得到exe文件名,好难啊!
- smtp协议问题,我将一个服务器SOCKET帮顶在一个邮件服务器上,然后连接,但是连接后服务器应该有个回应,但是我没有接受到,怎么会事?
- 如何让winpcap暂时停止监视?
- Unicode编程,在98下如何处理哪几个类库,,,,头大了
- 数组转cstring的问题
- 模态对话框的问题,急!!
- MFC把处理消息的窗口过程全部改换成一个AfxWndProc函数是否多此一举??
- TXT文件无BOM,该如何判断编码格式
当时我以文本的形式发送,对方接受后写在html文件里/*-------------------------------------------------------------------------------------------------------------------
函数功能:发送HTTP头
参 数:sockfd 服务器句柄;
head HTTP头
返回值: 成功返回0,失败返回错误代码
--------------------------------------------------------------------------------------------------------------------*/
int SendHttpHead(int sockfd, HTTPHEAD head)
{
char data[100];
char dataEnc[100]; char httphead[500] = "POST ";
strcat(httphead, head.servicename);
strcat(httphead, " HTTP/1.0\n"); strcat(httphead, "Connection: keep-alive\n");
strcat(httphead, "Content-Type: text/html; charset=\"gb2312\"\n"); strcat(httphead, "Content-Length: ");
strcat(httphead, head.ContentLength);
strcat(httphead, "\n"); strcat(httphead, "Host: ");
strcat(httphead, head.HostIP);
strcat(httphead, ":");
strcat(httphead, head.HostPort);
strcat(httphead, "\n"); strcat(httphead, "Accept: text/html, */*\n");
strcat(httphead, "User-Agent: Mozilla/3.0 (compatible; Indy Library)\n"); strcat(httphead, "Authorization: Basic ");
strcpy(data, head.TaxPayerNO);
strcat(data, ":");
strcat(data, "888888\n");
Base64_Enc(dataEnc, data, strlen(data));
strcat(httphead, dataEnc);
strcat(httphead, "proxy-Authorization: Basic Og==\n");
if ( send(sockfd, httphead, strlen(httphead) ,0) == -1 )
{
return -1;
}
return 0;}
youyingbo,请问你传送的头部文件要包含些什么东西呢??我看你的头部文件写的东西很多,能解释下么?