Sign in to follow this  

VB6 Chat userlist problem

This topic is 4685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm still writing that chat program and I've hit another problem. I'm trying to get a user list to work based on names sent in by the client and added to a list called lstUsers, on the server interface. The server receives the name fine, it's just I want to send out the whole list to newly connected clients at connection time. I have a winsock control array called Wsck_chatters. Here's my code (server side):
Public Sub handledispatch()

For s = 0 To frmMain.Wsck_chatters.UBound

   For r = 0 To frmMain.lstUsers.ListCount
   
   If frmMain.Wsck_chatters(s).State = sckConnected Then
   
       frmMain.Wsck_chatters(s).SendData "theuserlist" & "µ" & frmMain.lstUsers.List(r)
   
   End If
   
 Next r
       
Next s

End Sub


The client code at the other end is:


Public Sub updateulist(ByVal incoming As String)

Dim message() As String

message() = Split(incoming, "µ", -1)

username = message(1)


If username <> "" Then

   For b = 0 To frmMain.lstChatters.ListCount
   
       If frmMain.lstChatters.List(b) <> username Then
       
       frmMain.lstChatters.AddItem username

       frmWhisper.lstUsers.AddItem username
       
       End If
       
   Next b
   
End If

End Sub


The username is being extracted from the received string called incoming. The user name should be added to lstChatters on frmMain, but instead this happens. Assume the user name was john johntheuserlist is added instead of just john. When a second client connects with a different name, johntheuserlist is transmitted to it, and appears for the second time in the first client to connect. I have absolutely no idea how this is happening, and I'm working to a deadline. I do, however, think the problem lies serverside. Any help any of you can offer will be greatly appreciated. Thanks in advance, ukdeveloper

Share this post


Link to post
Share on other sites

This topic is 4685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this