http post的问题

chaylenliu 2008-06-06 03:37:03
下载了那个典型的http 的例子,也看的差不多了,但是我想把它改为实现c/s的数据传输,把我的数据传给局域网的服务器上,请问思路是什么? 我有点迷糊了!
void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
const TDesC8& aContentType,
const TDesC8& aBody)
{
SetupConnectionL();

// Parse string to URI
TUriParser8 uri;
uri.Parse(aUri);

// Copy data to be posted into member variable; iPostData is used later in
// methods inherited from MHTTPDataSupplier.
delete iPostData;
iPostData = aBody.AllocL();

// Get request method string for HTTP POST
RStringF method = iSession.StringPool().StringF(HTTP::EPOST,
RHTTPSession::GetTable());

// Open transaction with previous method and parsed uri. This class will
// receive transaction events in MHFRunL and MHFRunError.
iTransaction = iSession.OpenTransactionL(uri, *this, method);

// Set headers for request; user agent, accepted content type and body's
// content type.
RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
SetHeaderL(hdr, HTTP::EAccept, KAccept);
SetHeaderL(hdr, HTTP::EContentType, aContentType);

// Set this class as an data supplier. Inherited MHTTPDataSupplier methods
// are called when framework needs to send body data.
MHTTPDataSupplier* dataSupplier = this;
iTransaction.Request().SetBody(*dataSupplier);

// Submit the transaction. After this the framework will give transaction
// events via MHFRunL and MHFRunError.
iTransaction.SubmitL();

iRunning = ETrue;
_LIT(KConnecting,"Connecting...");
iObserver.ClientEvent(KConnecting);
}
...全文
75 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
netlib 2008-06-06
  • 打赏
  • 举报
回复
建议:
楼主所写的SDK所带的例子类似,照例应该不会有问题,但其实数据在服务器端是以什么表现出来的,要确定数据是否发现及http数据包如何组织,建议调试时跟踪网卡数据,可以确定数据是不是已经传送出去。我觉得数据可能已经传出,主要是web server那面怎么读是个问题。个人看法
chaylenliu 2008-06-06
  • 打赏
  • 举报
回复
或者说,我知道往输入的地址传递数据,但是往局域网的服务器上传递,应该怎么写网址?服务器应该具备什么条件?

3,120

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧