Results 1 to 4 of 4

Thread: vb chatprogram

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    4

    vb chatprogram

    does anyone know where i can find likea tutorial or code for a vb chat client and server? thanks.

  2. #2
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    asdf

  3. #3
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    You'll need to use a winsock control and set up some type of protocol.

    Protocol can be pretty basic. You'll need to set up commands, length descriptors.

    Like

    chat[length of message in base 256][message]

    It can also help to standardize your protocol.

    Thus:

    chat[length descriptor 2 characters]00000[message]

    Thus the 0's can be reserved to store any value you may need for the packet. Then your data will always start on the 12'th byte offset. Always put the variable lengths at the end. Even if sending multiple data strings.

    Like, we'll use our reserves:

    chat[length of name 2chr][length of message 2 chr]000[name][message]

    And always put length descriptotrs within eachother's reach. As you do not always get an entire pakcet in one shot, or you may get several in one shot.

    Then you can do conditionial checks.

    If len(buffer) > 4 then 'ok we have the protocol command
    if len(buffer) >= 4 + lengths then ' ok we have a valid packet
    select case left$(buffer,4) ' get the command
    case is = "chat"
    'get lengths
    name = mid$(buffer,12,len_name)
    message = mid$(buffer,13+len_name)
    'process
    end select
    end if
    end if

  4. #4
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765


    Use TCP with Winsock, and as you go you may want to add special things, like adding a new user, so you could check if theres a * at the beginning of the message.
    Don't Rate my posts.

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