My suggestion to you would be to use active objects with asynchronous
operations. I cannot understand why some people insist on putting the
thread
to sleep while waiting for some asynchronous method to complete...
Lucian
"MW Ron" <mwron@[EMAIL PROTECTED]
> wrote in message
news:mwron-BDB7DD.15090901102004@[EMAIL PROTECTED]
> In article <ebeef0a2.0409230201.c6a1f6@[EMAIL PROTECTED]
>,
> cris_miron@[EMAIL PROTECTED]
(Cristian Miron) wrote:
>
> Hi Cristian,
>
> I'm sorry but I could not come up with any answer. Metrowerks does not
> support programming questions, you need to take those to Symbian. You
> might try NewLC http://www.newlc.com/
they have programmers forums.
>
> Ron
>
>
> > I am trying to communicate using Bluetooth. When I try to receive a
> >large block of data (~40K) using RecvOneOrMore function from my
> >emulator (with epoc and BH4-X driver for USB adapters) in a loop (to
> >get all the data, pieces by pieces), after 2-5 loops, I get this
> >TRequestStatus.Int() value : 0x80000001 ( != KErrUnknown or any other
> >KErrxxxxx system wide error).
> > This is my code:
> >
> > //..
> >
> > int bytes_received = 0;
> >
> > while(bytes_received < size)
> > {
> > iSocket.RecvOneOrMore(str, 0, iStatus, aLen);
> > User::WaitForRequest(ilStatus);
> >
> > int len = str.Length();
> >
> > if(!IsActive())
> > SetActive();
> >
> > switch(iStatus.Int())
> > {
> > case KErrNone:
> > break;
> > // .
> > case KErrUnknown:
> > iConnected = false; break;
> > // .
> > default:
> > iConnected = false; break; // iStatus.Int() = 0x80000001 !!!
> > }
> >
> > if (ilStatus == KErrEof)
> > {
> > iConnected = EFalse;
> > return NULL;
> > }
> >
> > for (int i = 0; i < len; i++)
> > buffer[bytes_received + i] = (char)str[i];
> >
> > bytes_received += len;
> >
> > str.Zero();
> > }
> >
> >What is the problem here?
> >
> >Thank you.
> >
> >
> >Cristian Miron
>
> --
> Metrowerks Community Forum is a free online resource for developers
> to discuss CodeWarrior topics with other users and Metrowerks' staff
> -- http://www.metrowerks.com/community
--
>
> Ron Liechty - MWRon@[EMAIL PROTECTED]
- http://www.metrowerks.com


|