Crash if no message is received from a SOCKITsendnrecv call

Project:SOCKIT - speaking and listening to TCP/IP network sockets using IGOR Pro
Version:IGOR.5.00.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:andyfaff
Status:closed
Description

A crash occurred if the socket in the call to SOCKITsendnrecv does not return a message. This is because PutCStringInHandle cannot handle being passed a NULL pointer. The crash only occurred if another socket that you have open (not the one you sent the message to) has a message waiting to be read.

Updates

#1 submitted by andyfaff on June 19, 2008 - 05:08

Fixed bug by testing to see if there was a message received with length >0. If the message is zero length then make the message null terminated.
Don't put this null message in the bufferwave, as nothing was received. Put the message in S_tcp though.

if(!chunk.getData()){
	chunk.WriteMemoryCallback('\0', sizeof(char), 1);
	goto done;
} 

Back to top