- // Wait for a message to arrive
- while( !(len = SysGetMessage(&tid, NULL)) )
- {
- _SysWaitEvent(THREAD_EVENT_IPCMSG);
- }
-
- // Check if the message came from the server
- if(tid != giConnectionNum)
- {
- _SysDebug("%i byte message from %i", len, tid);
- // If not, pass the buck (or ignore)
- if( gAxWin3_MessageCallback )
- gAxWin3_MessageCallback(tid, len);
- else
- SysGetMessage(NULL, GETMSG_IGNORE);
- continue ;
- }
-
- // If it's from the server, allocate a buffer and return it
- ret = malloc(len);
- if(ret == NULL) {
- _SysDebug("malloc() failed, ignoring message");
- SysGetMessage(NULL, GETMSG_IGNORE);
- return NULL;
- }
- SysGetMessage(NULL, ret);
- break;
+ // Using CONNTYPE_SENDMESSAGE and server message has arrived
+ ret = malloc(len);
+ if(ret == NULL) {
+ _SysDebug("malloc() failed, ignoring message");
+ SysGetMessage(NULL, 0, GETMSG_IGNORE);
+ return NULL;