|
-
Nov 6th, 2002, 09:00 PM
#1
Thread Starter
New Member
vb chatprogram
does anyone know where i can find likea tutorial or code for a vb chat client and server? thanks.
-
Nov 6th, 2002, 09:08 PM
#2
Fanatic Member
-
Nov 6th, 2002, 11:51 PM
#3
So Unbanned
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
-
Nov 7th, 2002, 12:20 AM
#4
PowerPoster
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|