- // Wait for a message to arrive
- while( !(len = SysGetMessage(&tid, NULL)) )
- {
- _SysWaitEvent(THREAD_EVENT_IPCMSG);
- }
+ // 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;
+ }
+ _SysGetMessage(NULL, len, ret);
+ break;
+ }
+
+ if( giConnectionType != CONNTYPE_SENDMESSAGE )
+ {
+ if( FD_ISSET(giConnectionNum, fds) )
+ {
+ char tmpbuf[STATICBUF_SIZE];
+ char *data = tmpbuf;
+ size_t len = _SysRead(giConnectionNum, tmpbuf, sizeof(tmpbuf));