InterviewSolution
| 1. |
When Reading From A Socket The Phone Reads Whatever It Can In One Go, While The Emulator Reads Large Packets In Chunks. Why? |
|
Answer» This is a LIMITATION of the phone. Program should call ISOCKET_Readable() to be informed when more data can be read from the stream. The callback routine registered by ISOCKET_Readable() will be invoked whenever data becomes available---you can usually call ISOCKET_Read() at this point. Continue calling ISOCKET_Readable() for as long as your program EXPECTS more data. rv = ISOCKET_Read(piSock, (byte *)szBuf, sizeof(szBuf)); This is a limitation of the phone. Program should call ISOCKET_Readable() to be informed when more data can be read from the stream. The callback routine registered by ISOCKET_Readable() will be invoked whenever data becomes available---you can usually call ISOCKET_Read() at this point. Continue calling ISOCKET_Readable() for as long as your program expects more data. rv = ISOCKET_Read(piSock, (byte *)szBuf, sizeof(szBuf)); |
|