|
-
May 11th, 2006, 05:47 AM
#1
Thread Starter
New Member
Help with winsock sending data
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:
Function SendData(Index As Integer, Data As String)
frmServer.ServerSck(Index).SendData & "%$"
End Function
when the server recieve data I pass it to a function for proccessing the data, somthing like this:
VB Code:
Function ProcData(Index As Integer, Data As String)
Dim DataA() As String
Dim DataPacket As String
Dim DataPacketA() As String
Dim i As Integer
DataA() = Split(Data, "%$") 'Split up the incoming commands
For i = 0 To UBound(DataA) - 1
If DataA(i) <> "" Then
DataPacket = DataA(i)
DataPacketA() = Split(DataPacket, "|") 'Split the paramaters
Select Case LCase(DataPacketA(0))
Case "login"
'I would call the login function here
End Select
End If
DoEvents
Next i
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:
Call SendData Index, "Data"
Call Function1 Index
Call Function2 Index
Call SendData Index, "Data2"
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
-
May 11th, 2006, 10:35 AM
#2
New Member
Re: Help with winsock sending data
you mean nothing of your data is sent?
-
May 11th, 2006, 11:35 AM
#3
Thread Starter
New Member
Re: Help with winsock sending data
What I mean is only some data gets send.
When a client logs in I need to send if various information about the account etc
The problem is that all my calls to the functions that send data never get called
eg
VB Code:
Call SendData Index, "Log in ok"
Call SendData Index, "Info"
Call Function1 Index
Call Function2 Index
Call Function3 Index
Function1 - 3 are just functions similar to sendData.
The client would only recieve the first 2 and on odd times the 3rd.
-
May 14th, 2006, 10:12 PM
#4
Hyperactive Member
Re: Help with winsock sending data
hi i don;t know if this will work, but I had the same sort of problum a few days bk when building a messanger program, anyway I used DoEvents after each send ,
anyway Give it a try hope it may help
Code:
Function SendData(Index As Integer, Data As String)
frmServer.ServerSck(Index).SendData & "%$" & vbcrlf
DoEvents
End Function
When your dreams come true.
On error resume pulling hair out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|