Debugging in VB6

Started by
1 comment, last by ukdeveloper 19 years, 2 months ago
I've got a serious problem. My chat suite consists of 2 separate programs, client and server. The client relies on data being sent from the server to update the user list. This was a pain to get working, and I thought I had it working fine. However, it only works fine when I run it in VB with that debugging feature when you click the code and it goes red, in the server. Running it without the debugger active like this causes the program to go slightly wrong and not update the user list correctly. What causes it to only go wrong outwith debug mode? Is there any way around it? Starting the server with full compile (Ctrl+F5) made no difference. Please help. ukdeveloper.
Advertisement
Quote:Original post by ukdeveloper
I've got a serious problem.

My chat suite consists of 2 separate programs, client and server. The client relies on data being sent from the server to update the user list. This was a pain to get working, and I thought I had it working fine.

However, it only works fine when I run it in VB with that debugging feature when you click the code and it goes red, in the server. Running it without the debugger active like this causes the program to go slightly wrong and not update the user list correctly.

What causes it to only go wrong outwith debug mode? Is there any way around it? Starting the server with full compile (Ctrl+F5) made no difference.

Please help.

ukdeveloper.



Could you post the code, or at very least the affected section. It will be a lot easier for us to help you :)
Patrick
There's a fair bit, here goes:

Server:
 For r = 0 To frmMain.lstUsers.ListCount - 1            handleout = frmMain.lstUsers.List(r)            If frmMain.lstUsers.List(r) <> "" And frmMain.lstUsers.List(r) <> "theuserlistµ" Then            datastream = "theuserlist" & "µ" & handleout            End If            Wsck_chatters(Index).SendData datastream                        DoEvents                        datastream = ""                        handleout = ""    Next r


The list box contains user names transmitted by the clients as they connect. The idea is that when a user joins the server, the names of those who got there before them will be transmitted to their user list.

Client code that receives it:
Public Sub logonulist(ByVal incoming As String)Dim message() As Stringmessage() = Split(incoming, "µ")Dim username As Stringusername = message(1)For s = 0 To frmMain.lstChatters.ListCount    If frmMain.lstChatters.List(s) <> username Then        frmMain.lstChatters.AddItem username    frmWhisper.lstUsers.AddItem username    Exit For        End IfNext susername = ""incoming = ""End Sub


"incoming" is the total string sent by the server. The split function is used to extract the username and add it to the chat list.

In debug mode, or indeed just running client and server from within VB, and connecting a .exe of the same client, works perfectly.

It all goes wrong when all 3 are executables running independently of VB. Let's say a client connected called "#1". When he connects, "#1" is transmitted back by the server to his userlist. "#2" then connects. Instead of getting "#1" and "#2" in his list, he gets "#1theuserlist" (name of original client) instead of "#1" and "#2". As I say, it all works perfectly when one of them runs within VB, either debug or not, and the desired result is achieved. It all goes wrong when it's all .exe's. I am testing it by running server and both clients on the same machine, using the IP address 127.0.0.1 to connect.

Sorry if this is taking up valuable time.

This topic is closed to new replies.

Advertisement