Click to See Complete Forum and Search --> : Making my chat program multi user
DanF
Feb 18th, 2000, 06:20 PM
I have made a chat program, where a user connects to nother by entering their IP address and clicking on connect. so i have it working between two people, but how could i get it to allow unlimited users, with everyone receiving messages that everyone enters?
so if the first user connects to the second, and the second to the third. the first and first should see eachother's messages also.
i'd appreciate any help!!
thanks,
Dan
privoli
Feb 20th, 2000, 10:33 AM
This can be done, with some sockets coding... Try some of the following example code...
Rather than have everyone connect to everyone else and throw ports and sockets around, make one dedicated server that all users conected to...
For x = 1 to SckChat(UBound)
SckChat(x).SendData ChatMessageStr
DoEvents 'Use this prevent buffer flooding, do NOT remove this.
Next x
That will send the text ChatMessageStr
to all the users connected to your server.
If you want some code on how to accept multiple connections on the same port, IE: have 10 users connected to your server on port 115 email me and i'll send you some code...
Cheers!
------------------
Regards,
Paul Rivoli
-------------------
privoli@bigpond.com
http://users.bigpond.com/privoli
DanF
Feb 21st, 2000, 01:35 AM
What does (Ubound) mean? thanks,
Dan
JButi
Feb 23rd, 2000, 08:40 AM
UBound is the total number of winsocks connected. Therefore, if you have 5 connections, UBound would equal 5. So the code above is sending the data to all 5 winsock controls.
Hope this answers your question.
Fox
Feb 24th, 2000, 06:14 PM
If sckChat is your Winsock control you can use
sckChat.Count
That's the connection count as well.
swine
Feb 24th, 2000, 10:36 PM
I thought I would sneak this 'chat' related question in this thread:
Anyone know of any chat client base code that will work against the IRC servers, like DALNET etc? I need a custom code version similiar to MIRC.
Thanks.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.