// === CODE ===
void AxWin3_Connect(const char *ServerDesc)
{
- _SysDebug("ServerDesc = %s", ServerDesc);
- if( !ServerDesc )
- {
+ _SysDebug("ServerDesc (argument) = %s", ServerDesc);
+ if( !ServerDesc ) {
ServerDesc = gsAxWin3_int_ServerDesc;
}
_SysDebug("ServerDesc = %s", ServerDesc);
case '6': case '7': case '8': case '9': case '0':
giConnectionType = CONNTYPE_SENDMESSAGE;
giConnectionNum = atoi(ServerDesc);
+ if( giConnectionNum == 0 ) {
+ _SysDebug("Invalid server PID");
+ exit(-1);
+ }
break;
case 'u':
while(*ServerDesc && *ServerDesc != ':') ServerDesc ++;
switch(giConnectionType)
{
case CONNTYPE_SENDMESSAGE:
- SysSendMessage(giConnectionNum, size, Msg);
+ _SysSendMessage(giConnectionNum, size, Msg);
break;
case CONNTYPE_UDP: {
// Create UDP header
char tmpbuf[giAxWin3_int_UDPHeaderLen + size];
memcpy(tmpbuf, gaAxWin3_int_UDPHeader, giAxWin3_int_UDPHeaderLen);
memcpy(tmpbuf + giAxWin3_int_UDPHeaderLen, Msg, size);
- write(giConnectionNum, tmpbuf, sizeof(tmpbuf));
+ _SysWrite(giConnectionNum, tmpbuf, sizeof(tmpbuf));
}
break;
case CONNTYPE_TCP:
- write(giConnectionNum, Msg, size);
+ _SysWrite(giConnectionNum, Msg, size);
break;
default:
break;
{
int len;
tAxWin_IPCMessage *ret = NULL;
- pid_t tid;
+ int tid;
_SysSelect(nFD, fds, NULL, NULL, NULL, THREAD_EVENT_IPCMSG);
// Clear out IPC messages
- while( (len = SysGetMessage(&tid, 0, NULL)) )
+ while( (len = _SysGetMessage(&tid, 0, NULL)) )
{
if( giConnectionType != CONNTYPE_SENDMESSAGE || tid != giConnectionNum )
{
if( gAxWin3_MessageCallback )
gAxWin3_MessageCallback(tid, len);
else
- SysGetMessage(NULL, 0, GETMSG_IGNORE);
+ _SysGetMessage(NULL, 0, GETMSG_IGNORE);
continue ;
}
ret = malloc(len);
if(ret == NULL) {
_SysDebug("malloc() failed, ignoring message");
- SysGetMessage(NULL, 0, GETMSG_IGNORE);
+ _SysGetMessage(NULL, 0, GETMSG_IGNORE);
return NULL;
}
- SysGetMessage(NULL, len, ret);
+ _SysGetMessage(NULL, len, ret);
break;
}