[futurebasic] Reoccuring Bug

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Sean -G3- <mclaughlin@...>
Date: Sat, 12 Jun 99 14:21:54 -0400
I am getting a bug which says "Array Bounds error at line 287." I got it 
once while I was revising a version, and I couldn't work it out. So I 
went back to an old version. All went well for another day or so. Then I 
got it again.

-------------------------

Both times, it was in line 287, so I could narrow it down to the a TCP/IP 
function:
LOCAL FN TCPSendData%(stream&, dataPtr&, length%, retry%)
  LONG IF length% > 0
    myWDS.wdsLength%(0)	= length%    'This is line 287
<snip>


This function is being called by a function which accepts a normal string:
CLEAR LOCAL
LOCAL FN connWriteString(x$)
DIM err
'sends the string over the connection
err = FN TCPSendData%(gTCPcon.TCPCStream&, @x$+1, LEN(x$), _false)
END FN = err


The very first time that my program sends data over the connection is 
through FN sayHELO:
CLEAR LOCAL
LOCAL FN sayHELO
  DIM err, clientHandshake$, serverHandshake$, temp$
  
  err = _noErr
  clientHandshake$ = "TRTPHOTL" + CHR$(0) + CHR$(1) + CHR$(0) + CHR$(2)
  serverHandshake$ = "TRTP" + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0)
  
  SELECT gSubStep
    CASE 0                  'send HELO command
      FN connWriteString(clientHandshake$)
<snip>

-------------------------

When I REM out the FN connWriteString(clientHandshake$), it does not get 
an error bounds error, and it just sits there until it times out. So that 
is definately the bad line... But I have no idea why. I have another 
version which has that same code, but works. I used OTSession Watcher to 
see if anything was sucessfully sent. The connection was established, but 
nothing was sent.

My INCLUDE Structure looks like this:
-HickoryStick.MAIN
  -MainCommands.INCL
    -Protocols.INCL
      -SendReceive.INCL
        -LongStrings.INCL
        -TransportHighCmds.INCL
          -TransportLowCmds.INCL

FN sayHELO is in MainCommands, and FN connWriteString is in 
TransportHighCmds. This is true for both the working and non-working 
versions. I haven't been able to get anything useful from the debugger.