Symbian socket 网络编程方法
2010-03-18 20:59:00 来源:WEB开发网核心提示:iSocket.Connect(iAddress, iStatus);User::WaitForRequest(iStatus);if (iStatus.Int() ==KErrNone){iStatus = KRequestPending;iSocket.Write(writeBuf,iStatus);User::W
iSocket.Connect(iAddress, iStatus);
User::WaitForRequest(iStatus);
if (iStatus.Int() ==KErrNone)
{
iStatus = KRequestPending;
iSocket.Write(writeBuf,iStatus);
User::WaitForRequest(iStatus);
if (iStatus.Int() ==KErrNone)
{
TSockXfrLength iDummyLength;
TInt recvSize = 0;
for(;;)
{
iStatus = KRequestPending;
iSocket.RecvOneOrMore(recvBuf, 0, iStatus, iDummyLength);
User::WaitForRequest(iStatus);
if (iStatus.Int()==KErrNone)
{
recvSize += recvBuf.Length();
if(iBuffer==NULL)
iBuffer = HBufC8::NewL(recvSize);
else
iBuffer = iBuffer->ReAlloc(recvSize);
iBuffer->Des().Append(recvBuf);
}
else
{
break;
}
}
}
}
iSocket.Close();
}
iSocketServ.Close();
}
iNif.Close();
return iBuffer;
}
此段代码只是对socket用法
更多精彩
赞助商链接