Results 1 to 11 of 11

Thread: [RESOLVED] Help with VB6 Network coding! Doesn't go in correct order!

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    62

    [RESOLVED] Help with VB6 Network coding! Doesn't go in correct order!

    Ok I've been using this coding for awhile, the deeper I got into it I realized that it doesn't do everything in order.

    VB Code:
    1. Private Sub WStcpClient_DataArrival(ByVal bytesTotal As Long)
    2.     Static sBuffer As String
    3.     Dim Data As String, DataArray() As String, ComArray() As String
    4.     Dim i As Integer, j As Integer, ComI As Integer
    5.     'Get the data from WinSock, Seperate Packets and add each packet (A Command) to the Command Array
    6.     WStcpClient.GetData Data
    7.     Data = sBuffer & Data
    8.     ComArray = Split(Data, packetDelimiter)
    9.     'Save the stuff to carry over to the next event
    10.     sBuffer = ComArray(UBound(ComArray))
    11.     'Loop Through All Commands (Packets) Recieved
    12.     'The last entry is incomplete or "" so ignore it
    13.     For ComI = 0 To UBound(ComArray) - 1
    14.     'Error Handle, If No Data then go to next
    15.         If ComArray(ComI) <> "" Then
    16.             'Stop Loop Hogging resources
    17.             DoEvents
    18.             MsgBox ComArray(ComI) 'VIEW INPUT DATA FOR DEBUG
    19.             'Now Split the current command (Packet) into the Data Array (Array Of Variables unique to the command code
    20.             ' (The command code is in place Zero of the array and is a two letter code telling the client what command to
    21.             ' process, the remaining places are variables needed to do the command )
    22.             DataArray = Split(ComArray(ComI), packetDelimiter)
    23.             '####Data in Data Array Is Proccesed here####
    24.             Call ProcessData(ComArray(), ComI)
    25.         End If
    26.     Next ComI
    27. End Sub

    Generally it will process it after wards. but lets say it recieves three things to display in a textbox all at once, but sent out are these:

    "1"
    "2"
    "3"

    when you put the debugger on you see it in order, but when it finishes processing in the textbox/etc you will see it in the order backwards more or less, generally what would be displayed is

    "3"
    "2"
    "1"

    This only happens when the coding is sent quicker. Can anyone tell why? I found this out when the NPC was attacking before entering the room, generally when I put the debugger on, you'd see the enter room message being first, then the attacks, but since it was all together, it ended up attacking first then you'd see him enter the room.

    What it seems like more or less it processes the last thing it gets first.. Not sure what to do.
    Last edited by Valleriani; Jan 9th, 2007 at 01:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width