FTP客户端请求失败
FTP client request failure
我正在尝试用c++开发FTP协议。它接受来自客户端的请求类型(get或put),然而,在这两种情况下,服务器总是接收put请求,而不执行任何功能。
下面是比较请求类型的代码:if(strcmp(argv[3],"get")==0)
smsg.type=REQ_GET; //REQ_TIME;
else if (strcmp(argv[3],"put")==0)
{
smsg.type=REQ_PUT; //REQ_SIZE;
}
else err_sys("Wrong request typen");
,这是当get请求发送到服务器时执行的部分:
if(smsg.type=REQ_GET)
{
cout<<"Iam inside get"<<endl;
cout<<smsg.type<<endl;
//send out GET message
memcpy(smsg.buffer,&req,sizeof(req)); //copy the request to the msg's buffer
smsg.length=sizeof(req);
fprintf(stdout,"Send a GET request to %sn",argv[1]);
if (msg_send(sock,&smsg) != sizeof(req))
err_sys("Sending req packet error.,exit");
//receive the response
if(msg_recv(sock,&rmsg)!=rmsg.length)
err_sys("recv response error,exit");
//cast it to the response structure
respp=(Resp *)rmsg.buffer;
printf("Response:%snnn",respp->response);}
当显示"respp->response"时,它不返回任何东西,并且文件的大小始终为零。
谁有解决这个问题的办法?如有任何帮助,不胜感激。- if(smsg.type=REQ_GET)
+ if(smsg.type==REQ_GET)
下次尝试在编译时使用-Wall,它可能会捕获这种错误
相关文章:
- 如果没有malloc,链表实现将失败
- 模板参数替换失败,并且未完成隐式转换
- 如何解决来自 arduino 的 post 请求的问题,在失败之前只收到 2-3 次
- C++ 对 nodejs 服务器的 POST 请求失败(基于套接字)
- Qt Post请求正在执行但失败
- 为什么这个简单的服务器在非常低的并发请求上失败
- c++ 调试断言在 HTTP 请求上失败
- malloc调用在一个看似很小的请求后失败
- 内核AIO(libaio)写入请求在启动时从保留的内存中写入时失败
- 对友好URL的POST请求失败
- X失败请求的错误:BadValue(整数参数超出操作范围)
- 获取POCO HTTPSClientSession发送请求时出错-证书验证失败
- CURL请求失败重试方法
- std::ifstream::read()读取的数据少于请求的数据,并设置失败位,原因不明显
- QNetworkAccessManager发送请求失败
- Allegro5 - openGL:失败请求的主要操作码:55 (X_CreateGC)
- 声纳-请求服务器版本失败
- 向facebook(Marmalade c++)发送图片请求响应失败
- libauth请求失败
- FTP客户端请求失败