Hello,

I've been using vb6 for a few month now and have experienced some problems using winsock.

I have a function for sending data from the server like this:

VB Code:
  1. Function SendData(Index As Integer, Data As String)
  2.     frmServer.ServerSck(Index).SendData & "%$"
  3. End Function

when the server recieve data I pass it to a function for proccessing the data, somthing like this:

VB Code:
  1. Function ProcData(Index As Integer, Data As String)
  2.     Dim DataA() As String
  3.     Dim DataPacket As String
  4.     Dim DataPacketA() As String
  5.     Dim i As Integer
  6.    
  7.     DataA() = Split(Data, "%$")         'Split up the incoming commands
  8.    
  9.     For i = 0 To UBound(DataA) - 1
  10.         If DataA(i) <> "" Then
  11.             DataPacket = DataA(i)
  12.             DataPacketA() = Split(DataPacket, "|")      'Split the paramaters
  13.            
  14.             Select Case LCase(DataPacketA(0))
  15.                 Case "login"
  16.                     'I would call the login function here
  17.             End Select
  18.         End If
  19.        
  20.         DoEvents
  21.     Next i
  22. End Function

when I call my login function it all works fine till it gets to the senddata calls, at the end of the function. I have lots of calls to other functions that in turn use the sendData function to send appropriate data, kind of like this:

VB Code:
  1. Call SendData Index, "Data"
  2. Call Function1 Index
  3. Call Function2 Index
  4. Call SendData Index, "Data2"
  5. Call Function3 Index

My problem is when it gets to all those calls it never sends everything it should. I tried using doevents and it fixed some of them, but usual led to it working somtimes and not others. I've read that using doevents can cause problems later on in development.

I also use a encryption class before sending the data if that would make any difference in data being sent or not.

Can anyone help?
If anyone needs more info or to see more of my code I'll be happy to post it.
Also the server is used for a custom mud.


Any help is appreciated.


Thanks