Hi all,
I just thought this was interesting.
CVI 6.0, W2k sp2..
I have a application that has a bunch of parsers in it. The design is to run
through a serial connection, a TCP/IP connection or both.
The serial connection uses 1 or 2 com ports,
the network connection uses 1, 2, or 3 ports.
Almost all communications travels over the first port.
the code runs a emulator program over a network connection in one mode.
If it is in emulation mode all messages come in thought the emulation
command processor first.
here is a fragment
***PANEL_TCP_RECEIVE is a textbox***
....
void parse_input( char *msg )
{
char weightdummy[18];// not static?
static int dtr = 0;
short linelen;
char dummy[132]={" "};
if(strlen(msg)==0) // not supposed to have 0 length m
essage here but...
linelen = 0;
else
linelen = strlen(msg); // if CR LF term subtract 2, if CR or LF subtract
1
strcpy (dummy, msg);// dummy3=msg // if not use dummy buffer
// loose msg content in some strange kind of pointer redirection
// seems to drop TCP/IP connection.....
SetCtrlVal (panelTCP, PANEL_TCP_RECEIVE, dummy);
msg[linelen] = 0; // make sure there is a null there or can get trash....
..........
//
if I don't assign msg to dummy before I insert message in the textbox
ie if I do
SetCtrlVal (panelTCP, PANEL_TCP_RECEIVE, msg);
I lose the conversation handle for reception of further messages.
The problem goes away if I do the dummy assign first.
The command parser works now but does anybody have any ideas why this can
happen??
Maybe it's just another example of a "been staying up late typing code
again" brain fart.
I did lose the TCP conversation handle on one pass through this part of the
parser,
But, the connection remained live for transmission on the same
handle.
Me I don't know π π π any ideas?