Jump to content
  • Advertisement
Sign in to follow this  

VB6 Chat userlist problem

This topic is 5053 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!