Symbian: clear buffer of RSocket object
Posted
by Heinz
on Stack Overflow
See other posts from Stack Overflow
or by Heinz
Published on 2009-09-22T15:56:35Z
Indexed on
2010/06/12
8:02 UTC
Read the original article
Hit count: 293
Hi,
I have to come back once again to sockets in Symbian. Code to set up a connection to a remote server looks as follows:
TInetAddr serverAddr;
TUint iPort=111;
TRequestStatus iStatus;
TSockXfrLength len;
TInt res = iSocketSrv.Connect();
res = iSocket.Open(iSocketSrv,KAfInet,KSockStream, KProtocolInetTcp);
res = iSocket.SetOpt(KSoTcpSendWinSize, KSolInetTcp, 0x10000);
serverAddr.SetPort(iPort);
serverAddr.SetAddress(INET_ADDR(11,11,179,154));
iSocket.Connect(serverAddr,iStatus);
User::WaitForRequest(iStatus);
Over the iSocket i receive packets of variable size. On very few occurences it happens that such a packet is corrupted. What I would like to do then is to clear all the data that is currently in the iSocket buffer and ready to be read. I have not seen any method of RSocket that allows me to clear the content of the buffer. Does anyone know how to do that? If possible, I would like to avoid using RecvOneOrMore() or similar recv function clear the buffer
Thanks
© Stack Overflow or respective owner