When transmitting large files, do we have to break the file up into packets before sending, or does BREW do this for me?

Submitted by: Administrator
You should simply send what you can, and ISOCKET_Write() will tell you how much data was actually sent. If there is data remaining to be sent, simply offset your data pointer by the amount indicated by your last call to ISOCKET_Write().

For Example:

void CommonWriteCB (void *pUser) {
char *psz = NULL;
int cbWrite;
… … …

SampleApp * pMe = (SampleApp*)pUser;

// pszData is the data to be written
psz = pszData;
cbWrite = STRLEN (pszData);

// Loop till all the bytes are written.
while (cbWrite > 0) {
rv = ISOCKET_Write(pMe->m_pISocket, (byte *)psz,

// No byte were written successfully. Register
// callback to try again later.
CommonWriteCB, (void *)pMe);
} else if (rv == AEE_NET_ERROR) {
// Write Error.

// In case of parital write, loop and write the rest
cbWrite -= rv;
psz += rv;
… … …
Submitted by: Administrator

Read Online Brew Job Interview Questions And Answers