Results 1 to 4 of 4

Thread: Nickname List Help with Winsock

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    2

    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.

  2. #2
    Lively Member
    Join Date
    Jul 2005
    Posts
    73

    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:
    1. Winsock.SendData "N:" & frmLogin.txtnick.Text


    and in the server data arrival i have

    VB Code:
    1. If Left(strRecivedData, 2) = "N:" Then
    2.   txtchat.Text = strRecivedData & " has joined chat."
    3.   arr() = Split(strRecivedData, ":")
    4.   Call addit(arr(1))
    5. End If
    6.  
    7.  
    8. Sub addit(x As String)
    9.   Dim a As Integer
    10.   For a = 0 To lstusers.ListCount - 1
    11.     If x = lstusers.List(a) Then Exit Sub
    12.   Next a
    13.   lstusers.AddItem x
    14. 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

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    2

    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.

  4. #4
    Lively Member
    Join Date
    Jul 2005
    Posts
    73

    Re: Nickname List Help with Winsock

    no problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width