Results 1 to 6 of 6

Thread: My chat server + client

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    238

    My chat server + client

    ok first for my client.

    I have everything made i was just wondering how after a set amount of lines the chat will clear OR once the text reaches the bottom it keep scrolling down.

    Now for my server.

    Everything is made but i wanna make it so that it displays the current online users. i have the thing that adds 1 to the count but i dunno how to minus one when someone disconnects.I also wanna make it so that after someoen disconnects the winsock array is closed.... anyone got any ideas how to do that?

    Thanks for your help,
    David

  2. #2
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: My chat server + client

    Well for your client you can use:

    Code:
    Private Sub Text1_Change()
        With Text1
            .SelStart = Len(.Text) + 1
        End With
    End Sub
    But Im not so positive on the server part.
    If my post was helpful please rate it

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    238

    Re: My chat server + client

    i use a list will that still work?

    EDIT

    nope it didn't work with List1 i changed the Text1 to List1's if ur wondering lol

  4. #4
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: My chat server + client

    Oh, didnt know you where using a Listbox, try this.. Add a timer and put this in it. Use a interval of about 500 (You can change it if needed).

    Code:
    Private Sub Timer1_Timer()
    With List1
        .ListIndex = .ListCount - 1
    End With
    End Sub
    If my post was helpful please rate it

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    238

    Re: My chat server + client

    ok that worked thx

  6. #6
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: My chat server + client

    Well on your server you can also have like a label for the users.


    Code:
    Dim i as long
    
    Private Sub Form_Load()
    Label1.Caption = "Online Users :: 0"
    i = 0
    End Sub
    Like that. Then in the Socket_ConnectionRequest put something like

    Code:
    i = i + 1
    With Label1
          .Caption = "Online Users :: " & i
    End With
    And in the Socket_Close sub put something like

    Code:
    i = i - 1
    With Label1
         .Caption = "Online Users :: " & i
    End With
    Now this may now work to good because clients with sockets can have multiple connects to the server. So it may count the same connection twice because of sockets. But thats the general idea of it.
    If my post was helpful please rate it

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