Nickname List Help with Winsock
Hi i got a multi user chat client, but now i'm trying to implemented a nickname lis, i tried adding a second winsock with different code then the chat prog. But figured out by just using one winsock.
The thing is when the winsock client connect it send to the server his nickname, now when the server get it it send to all the client the nickname and the socket their connect it.
Exemple:
client send : "Bob"
Server get's : "Bob"
Server add next available socket to the nickname, so if socket 5 is available then it would be: "Bob (5)"
Server send it
Client get it: "Bob (5)" and add to the nickname list.
*This is how far i went
Now that what i try to do and i got it (if their something similar you could refer it would be also helpful). Another prob i try to figure out is if a person signed out or close connection then his nickname will be remove from the list.
Thank you for your help. :wave:
Re: Nickname List Help with Winsock
not sure if this will help you much but in my client i have this in winsock connect
VB Code:
Winsock.SendData "N:" & frmLogin.txtnick.Text
and in the server data arrival i have
VB Code:
If Left(strRecivedData, 2) = "N:" Then
txtchat.Text = strRecivedData & " has joined chat."
arr() = Split(strRecivedData, ":")
Call addit(arr(1))
End If
Sub addit(x As String)
Dim a As Integer
For a = 0 To lstusers.ListCount - 1
If x = lstusers.List(a) Then Exit Sub
Next a
lstusers.AddItem x
End Sub
the only problem is that it wont take the names out when they disconnect but that would be easy to put in
hope it helps
-BladeZ
Re: Nickname List Help with Winsock
Thanks blaze, that exactly the same procedure i have , but different code, thing is the remove part is going to my head but can't seem to get it, but thank you.
Re: Nickname List Help with Winsock