# VBForums CodeBank > CodeBank - Visual Basic 6 and earlier >  [VB6] - Multi-User Chat Example (Winsock)

## DigiRev

I wrote this last night out of boredom and after reading a lot of posts about people wanting to make a basic multi-user chat room.

This is the most stripped-down code I could come up with that does things "correctly". For that reason, some of the code may seem more complex than it needs to be but I commented it pretty well.

I am going to write a tutorial to go along with it, as soon as I get free time.  :Wink: 

One common mistake a lot of client/server programs make is they don't program according to the TCP (streaming) protocol. Sometimes "packets" get split up, truncated, sent together, etc. and this data arrival event is coded to expect that and handle it smoothly.

I set it up so you can add in your own commands easily to the Data Arrival event.

If you have any questions/comments/suggestions, post them here. I kept out most features like private messages, file transfers, web cams, etc. to keep things simple and straightforward, but if someone wants something added in here let me know.

----------


## MrMakealotofsmoke

did i make you want to start this?

BTW, thanks for helping me out  :Smilie:

----------


## DigiRev

> did i make you want to start this?


Yes, actually, your thread (and a few others) is what inspired me to write this.




> BTW, thanks for helping me out


You're welcome.  :Smilie:

----------


## Debug.Assert

This is a nice lil project.
Is there a way that the Server could remove a user from the server and prevent their return?
What are some safe (safe = not likely to be in use) ports that can be used other than your default "1234"?

Thanks for sharing this.

----------


## Paul M

> Service      Port
> HTTP       80
> FTP         20,21
> Gopher 	   70
> SMTP 	   25
> POP3 	   110
> Telnet 	    23
> Finger 	     79
> Local loops/callbacks 	    0


Here are some publicly acceptable ports for the corresponding commuincation types.

----------


## DigiRev

> This is a nice lil project.
> Is there a way that the Server could remove a user from the server and prevent their return?
> What are some safe (safe = not likely to be in use) ports that can be used other than your default "1234"?
> 
> Thanks for sharing this.


Along with Hell-Lord's post, here's another list:
http://www.governmentsecurity.org/ar...ommonPorts.php

To remove a user from the server, do you mean to ban them? By IP? If you like, I can add that in there real quick.

----------


## psychotomus

how about allowing people to change the text colour? not how you have it now.

but if a user bolds there text, it will be bold on the other clients comps too. know what i'm saying? This is what I am having difficulty doing atm.

----------


## DigiRev

I'll add in text font/color/b/i/u, and IP banning. And I guess private messages while I'm at it.

----------


## Debug.Assert

> To remove a user from the server, do you mean to ban them? By IP? If you like, I can add that in there real quick.


Yes, thats what I meant. To remove a person from the chat "room"

----------


## DigiRev

> Yes, thats what I meant. To remove a person from the chat "room"


Adding in both a kick and ban feature.  :Smilie:

----------


## psychotomus

Heres some more things you can add. invite only chats (must be in the chat room and invite someone to enter), password chats,and set a user limit on chats.

Allready have password chats in my messenger. working on invite only chats now. kinda like mIRC channel modes.

----------


## DigiRev

Thanks psycho.

I've decided since I'm adding in these other things I might as well make it multi-room also like mIRC. So next update will have:

Private messagesFont, color, bold/italic/underline, etc.Multiple roomsInvites to roomsPrivate and passworded roomsOther things like hyperlinks

Thanks for all the ideas, if anyone has anymore let me know.

----------


## zynder

Im waiting for it Digi.

----------


## psychotomus

if he don't updateit soon. i'll update his source =)

----------


## DigiRev

Sorry I've been busy with work and other projects but I've already almost finished the update (which is a pretty big update). It will be uploaded tomorrow.

----------


## TheBigB

Ever tried smileys?
The only way I got it to work once was with the copy-from-clipboard method to RTF-box.

----------


## DigiRev

> Ever tried smileys?
> The only way I got it to work once was with the copy-from-clipboard method to RTF-box.


You can insert them directly into the .TextRTF property but I prefer the clipboard method because the other one can be buggy from my experience. I've got so many other projects going on right now I don't know if I will get the smilies put in.

If you want smilies, then apparently you can ask psycho to put them in since he is planning on updating this code anyway.  :Wink:

----------


## DigiRev

Sorry for another post. I've decided to just start from scratch and keep this first one as a basic example. The one I'm working on now will have more features than what is listed, so I hope this will satisfy everyone.  :Big Grin:  It will be up sometime tomorrow afternoon/evening.

----------


## DigiRev

Sorry it's taking so long. I've gotten a lot of requests from people to add in even more features.  :Sick:  

So I'm working on file transfers, web cameras, whiteboard, and more. You can visit this program's new website:

http://www.dannydotguitar.com/VBChat/

The site is new but I will be updating it so check back.

----------


## zynder

I cant download your chat app on your website.

----------


## DigiRev

It's coming soon. I've been working on a website for someone and it's taking all my time, but it's paying good money.

So I haven't given up on it or anything.

----------


## itzviper

have you given up yet digirev?  or you just been busy?  haha, just want to see if this project is still active.

----------


## werny

I am having troubles, me and my friend are trying this, and it works when he hosts the server but when i host he cant connect, it tells him he timed out, I tried turning off my firewall and it still gives him the time our message, has this happened to anybody else?

----------


## TheBigB

you probably connect to the net with a router. 
am I correct?

You'd need to set up an UPnP configuration. 
Dunno how to do that, but solves problems for p2p applications.

----------


## werny

ok ill look into it, I have never heard of that before

----------


## GDOG34

Here is a problem i encountered.

On my computer i run the server appkication 
2. on another computer i cannot connect to the ip. Why?
Do i have to use telnet or what?

----------


## TheBigB

what does the ip look like?
is it in the ranges:

10.0.0.0 - 10.255.255.255 
172.16.0.0 - 172.31.255.255 
192.168.0.0 - 192.168.255.255

btw, NAT traversal is the part I meant in the UPnP technologies

----------


## werny

192.168 range, class c i believe, and holy crap I am lost with all this upnp and NAT traversal crap, I cant find any download links or anything

----------


## TheBigB

an ip in the ranges I mentioned is a 'private' ip. 
it's your computer's ip within a network.
your network connects to the internet through a router. (which in for example my case is the wireless router)
the router has the public ip; the ip that connects you to the world. connections  go to the router, and the router determines the destination of the packets within that private network.

problem is; winsock doesn't know what computer it should target behind the public ip.

you probably have the router and you act as server within the private network.
your friend sends a packet to your router, but as there is no further destination info the router doesn't know what to do with the packet so it dumps it.

----------


## GDOG34

My ip looks like 192.168.1.72. Is there still a way where this can work? I never worked with winstock.

----------


## itzviper

you would need to setup port forwarding on your router. Log into your router, i'm not going to go into details on this, you can do a google search for the model number of your router and should find some kind of documentation. you need to forward the port that you're trying to connect on (example: port 2000) to your computers local IP (in your case 192.168.1.72).  This lets the router know that if a connection comes in on 2000 that it should relay the connection to your IP.  Without the port forward the router would deny the request.

----------


## TheBigB

http://portforward.com/english/route...outerindex.htm
of course an automatic alternative would be better for an application.

----------


## GDOG34

Woot i got it to work i had to alter the ports telling it which ones to use. I have a few question.

1. Is there a way to restreive the list of online users and put them in a listbox? This listbox differs from the one in the chat window.

2nd. Is there a way with this code where i can add a button and make a new chat window and be able to privite chat with a selected user?

Thx!

----------


## psychotomus

try changing the ip address to localhost. it will connect to yourself no matter what. i'm also about to release sim-chat as open source. link in sig =]

----------


## GDOG34

May i have an example?

----------


## GDOG34

I have a question i have this code and i and wondering if this can be inserted into the messenger above. There is a problem thought evertime it send the smile it will popup with your picture editor to show the picture. Can this be added to the code above to send smileys?


vb Code:
Private Sub Command1_Click()
'First, just add plain text:
rchText1.SelText = rchText1.SelText & "Guest: " & Text1 & vbCrLf
 'Then change what needs to be changed to pictures:
RefreshPics
DoEvents
rchText1.SelStart = Len(rchText1.Text) 'Put the start at the end, thats where you want to add the next line
Text1 = ""
Call Text1.SetFocus
End Sub
 Private Sub Form_Load()
rchText1.OLEObjects.Clear 'Clear the ole objects to prevent errors
End Sub
 Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
DoEvents
rchText1.OLEObjects.Clear 'You must add this or the
                            'program will crash. This doesnt
                            'happen in Windows 2k
DoEvents
End Sub
 Sub RefreshPics() 'This scans the text for :) and (l)'s to change
Dim lFoundPos As Long           'Position of first character
                                        'of match
Dim lFindLength As Long         'Length of string to find
 Dim MakeSure As Boolean 'I have this to do the procedure twice, just to "make sure"
  GoTo Skip:
Start:
MakeSure = True
Skip:
 lFoundPos = rchText1.Find(":)", 0, , rtfNoHighlight)
        While lFoundPos > 0
          rchText1.SelStart = lFoundPos
          'The SelLength property is set to 0 as
          'soon as you change SelStart
          rchText1.SelLength = 2
          rchText1.SelText = ""
          rchText1.OLEObjects.Add , , App.Path & "\smile.bmp" 'Add the picture after it has deleted the string
          DoEvents
          'Attempt to find the next match
          lFoundPos = rchText1.Find(sFindString, lFoundPos + 2, , rtfNoHighlight)
Wend
If MakeSure = False Then GoTo Start
 ' I guess by changing or adding a few lines, you
'   can make it add more pictures with different strings.
 End Sub
 Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click
End Sub

----------


## GDOG34

No help? The code above works but i need help inserting it into the project. Can someone alter this code where it can send images? 

Thx

----------


## Justin M

This is better than the chat i have in my program already, may I use this instead???

----------


## DigiRev

Hey guys...

Wow, I haven't been in here in forever.  :Big Grin:  I've been so busy trying to land a good job, build up a portfolio, do some freelance webdesigning for money, etc., that I haven't had much time at all to work on anything in VB.  :Frown: 

Anyway, that time is coming to an end and I will be able to get back to work on VBChat, the open source VB instant messenger.

I'll let you know as it progresses.

----------


## Justin M

lol I have a certian IP adress, but while I can connect to the chat thing,  no one else can??????????

 the port thing is set to port 1234, should that  be changed?

----------


## TheBigB

You're probably behind a router, making it unable for outsiders to access your chat-server.

Try redirecting port 1234 to your local IP if that's the case. 
You should then also make sure you have the public IP address and not the local one.

Reserved (Default) Local IP's:


```
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
```

You can get your public IP by going to whatismyip.com.
And as I mentioned before in this thread, a guide to port forwarding.

----------


## Justin M

You are right, I have a router, what is the local and public IP address and how can I find  them out?

EDIT: Ok I got my public IP its different than my local one though.

And when I find them, when people want to connect to my chat server what would they type in on the client end?

EDIT2: When I try to connect using my public IP and port 1234 I get the error connectionj forcefully rejected.

----------


## TheBigB

Look at the port forwarding I mentioned.

NOTE: you should be running the server application.

----------


## Justin M

Ok I picked my router on the site, but it asks  to select the program you are forwarding ports for from the list below

What would I pick?

----------


## TheBigB

The last line says:
If you do not see the program you are forwarding ports for, be sure to visit our Default Guide for this router.

Click that Default Guide.

----------


## Justin M

Ok it asks me if I want to forward  a single port,  is this what I want? And if yes, I want to forward port 1234?

----------


## TheBigB

Yes and yes.

----------


## Justin M

Ok, I did it, but when  I try to connect I get a time out error on my client end?

----------


## DigiRev

> Ok, I did it, but when  I try to connect I get a time out error on my client end?


As was said before, the port needs to be opened (1234 unless you change it). You shouldn't be getting any error which is why I think either the port was not opened correctly, or there is a firewall blocking access.

Here are some steps you (or anyone else experiencing this problem) should follow:

1. Disable the Windows XP Firewall (or other firewall if you have one) or allow BOTH the server _and_ client to access the internet through your firewall.

2. Go to Start -> Run -> and type "cmd" and press enter. (You may need to enter "command" for other versions of Windows). This will open a command prompt.

3. Type "ipconfig" and press enter. It should show your LOCAL IP address if you are behind a router (ie: 192.168.1.101). This is the IP address you will use to setup your router.

4. Now, you need to get into your router settings. You can usually do this by opening a web browser (Internet Explorer/FireFox, etc) and typing in your router's IP address. This is usually *192.168.1.1* or something like that.

5. It will prompt you for a username and password. The defaults are usually something like "admin/admin", "admin/administrator", etc.

6. Once you are in your router settings, you need to find "Port Forwarding". There are several fields. For the application name, enter anything, like "VBChat" or whatever. Then enter the starting port, and ending port. For this program, by default, the port is 1234. So enter 1234 in both boxes.

7. Then there is a "Protocol" dropdown box. This program uses TCP, but to be on the safe side, just select the "Both" option.

8. Enter the last 3 digits of your LOCAL IP, that was found in step #3.

9. Then save the settings. Close all instances of VBChat that you might have open, and restart it. It should work.




The quickest way, is to find the "DMZ" option in your router settings and enable it for your IP address. However, I don't recommend doing this as it opens ALL ports on your router and leaves your computer wide open.

----------


## DigiRev

I downloaded the source code and am currently adding in some more features (multiple rooms, private messages, _maybe_ emoticons, webcams, file transfers, whiteboard, and probably a few other things so stay tuned  :Stick Out Tongue: ).

----------


## Justin M

Thanks for the help, but in step 8:Enter the last 3 digits of your LOCAL IP, that was found in step #3 , where do I enter that?

----------


## DigiRev

> Thanks for the help, but in step 8:Enter the last 3 digits of your LOCAL IP, that was found in step #3 , where do I enter that?


It should be in the port forwarding settings. Here is a screenshot.

----------


## Justin M

Ok So I attached an image of my router settings, I am wondering if I did it right.

----------


## DigiRev

That looks right if you entered the correct IP address. Now you should run the server and have people connect to you.

----------


## Justin M

Ok Could you do me a favor and see if you can connect to IP 192.168.2.12 with port 1234?

No one is in my chat room  :Frown:

----------


## MrMakealotofsmoke

192.168.2.12 is your lan ip
www.whatismyip.com to get your external ip. If u have a dynamic ip it will change every 24 hours or so

----------


## Justin M

Its my computer IP,  so my external IP would be my router which is 142.167.89.15

What  would I have to change?

----------


## DigiRev

> Its my computer IP,  so my external IP would be my router which is 142.167.89.15
> 
> What  would I have to change?


Your router settings look right. You use your local IP (192.x.x.x) for that, like you did.

Your _external_ IP (142.167.89.15) is what you give to someone who wants to connect to your server.

Edit: I am connected to your server so it works.  :Smilie:

----------


## Justin M

OMG thank you so much, sorry if I don't reply to you in the chat room I have to go to school but thanks a million!!!!!

----------


## DigiRev

> OMG thank you so much, sorry if I don't reply to you in the chat room I have to go to school but thanks a million!!!!!


You're welcome.

Next (big) version will be out in the next day or two, features I am including are:

File transfers
Webcams
Custom rooms
Password-protected rooms
Whiteboard
Private messages
Kick/ban

Those are what I have planned for now, I might think of some other ones in the process.

----------


## Justin M

Kick and ban would be good.

----------


## Justin M

Wait a sec, if people who join my server can see my router  IP and my comp IP would that mean they can hack me???

----------


## TheBigB

If you use internet explorer or the windows firewall, there's a big chance people can  :Big Grin: 

Just kidding. 
But I personally have more faith in a non-M$ firewall.

----------


## DigiRev

> Wait a sec, if people who join my server can see my router  IP and my comp IP would that mean they can hack me???


If you're so worried about getting hacked from someone knowing your IP, then may want to unplug your modem and not use the internet.  :Wink:

----------


## Justin M

lol Thanks but  I would like to  have a sound play when someone sends a message, where would I put the play sound code?

And when some enters the chat?

----------


## DigiRev

> lol Thanks but  I would like to  have a sound play when someone sends a message, where would I put the play sound code?
> 
> And when some enters the chat?


Look in the DataArrival() event to find the name of the sub that is responsible for handling when a message is received and when someone enters/leaves.

Then go to the code for that sub and put your "play sound" code there.

Sorry it's taking so long for the update. I've been real busy doing jobs on www.rentacoder.com and haven't had any free time.

----------


## Justin M

lol thanks, its ok. Out of curosity, is there alot of money to be made on rentacoder?

----------


## TheBigB

Only if you're an advanced coder and are experienced in customer programming.

----------


## DigiRev

There are a lot of smaller projects < $200. There are also those that are $500-$2,000+. There's a wide variety of different types...for every possible programming language you can imagine. Not that many for VB6. Lots for PHP/MySQL, HTML, CSS, etc.

I've been doing a lot of the smaller ones, myself. Hopefully I can land a big one soon.  :Big Grin:

----------


## Justin M

Umm this is usually to ask, but could anyone download the free antivirus prog I made and see if they can log on.

welll maybe the code here can log on my chat server, cause alot of peeps say they can't 

the IP of the server is 142.167.72.254

----------


## Justin M

I was wondering, is there a way to change the color of the text you type with and when you send a message the text will look the same in the conversation box?

----------


## TheBigB

I don't know how this app is built, but if there is a regular textbox, you need to replace it with a RichTextBox control. 
With that, sending the .rtfText property (instead of the .Text), you might be able to send multiple colors, but I'm not sure though.

----------


## DigiRev

TheBigB is correct. If I remember my own project correctly, I used a standard TextBox to keep things as simple as possible.

My original plan was to make this and hope that people were able to learn from it and add in their own features as a learning experience, that's why I kept it so basic.

But I've gotten a lot of requests to modify it and so that is what I am almost done doing now (except I started a new one from scratch)...

Server setup wizard
Custom room creator with passworded rooms
User-created rooms
Rich text (using the RichTextBox control)
File transfers/folder sharing
Admin features for server (kick, ban, warn, global message)
Webcameras
Whiteboard

Finally done with all of my RentACoder projects so I have time to work on it now...stay tuned.  :Stick Out Tongue:

----------


## minidesigner

i am ready to see the updated version of this.

----------


## Justin M

Yea lets get the super version going!! 
lol

----------


## psychotomus

Id like to see how you do the webcams. Thats one thing I havn't been able to figure out ;]

----------


## minidesigner

i'm having trouble getting bold italics and underline to show in the chat window.  also my users are wanting to have special colors for their names, any help.

----------


## DigiRev

Every time I get back to work on this, something else keeps coming up. Just want to let you know that I _have_ been working on it and there really isn't much left to do and I am finishing it up.

Edit: minidesigner, choosing colors for names is a good idea actually, never thought of that. I will put that in there also.

----------


## Genovah

I would just like to thank DigiRev... I downloaded your source and have started fine tuning it for what I am looking for personally. I just want to thank you for being willing to do so much work for no monetary reward. A lot of people wouldn't be willing to do such work. I like the classic version and will continue coding ontop of it.

Question though (for anyone) is it going to be OK to continue programming in Visual Basic 6.0 or is Visual Basic 2008 Express the way to go for free lance programming for personal use?

----------


## MartinLiss

> I would just like to thank DigiRev... I downloaded your source and have started fine tuning it for what I am looking for personally. I just want to thank you for being willing to do so much work for no monetary reward. A lot of people wouldn't be willing to do such work. I like the classic version and will continue coding ontop of it.
> 
> Question though (for anyone) is it going to be OK to continue programming in Visual Basic 6.0 or is Visual Basic 2008 Express the way to go for free lance programming for personal use?




We like to have people create their own threads for questions like this but in any case, while VB6 will be around for several years at least, (sadly) you should probably switch over to 2008.

----------


## DigiRev

> I would just like to thank DigiRev... I downloaded your source and have started fine tuning it for what I am looking for personally. I just want to thank you for being willing to do so much work for no monetary reward. A lot of people wouldn't be willing to do such work. I like the classic version and will continue coding ontop of it.
> 
> Question though (for anyone) is it going to be OK to continue programming in Visual Basic 6.0 or is Visual Basic 2008 Express the way to go for free lance programming for personal use?


Thanks Genovah. You're doing exactly what I was hoping most people would do. Use this as a sort of framework to build from and/or learn how to use the Winsock control. That's why I kept it so stripped-down and simple as possible.

As MartinLiss said, you may want to switch over to 2008/.NET. Personally, I've been learning C++ (which is much different) because I don't like .NET at all.

----------


## Genovah

> Thanks Genovah. You're doing exactly what I was hoping most people would do. Use this as a sort of framework to build from and/or learn how to use the Winsock control. That's why I kept it so stripped-down and simple as possible.
> 
> As MartinLiss said, you may want to switch over to 2008/.NET. Personally, I've been learning C++ (which is much different) because I don't like .NET at all.


I haven't done VB6 since I was in highschool I have mostly been working on Flash projects and things of the sort but after finding this site I have found interest in program coding. I appreciate and lookforward to more projects from you and thank you both for your opinnions on which programs are best. I know very little about C++ but I like the interface of VB so maybe I'll switch over to 2008 in the near future. DigiRev is there a way to contact you personally? I would like to show you my re-vamp of your basic program... I only worked on it for a couple hours so not a whole lot has changed but perhaps with all the requests you have recieved you will have some ideas for me (not code trying to learn that on my own  :Wink: )


Thanks Martin for the welcome! Sorry for not starting a new thread for it.

----------


## Genovah

Sorry for the double post... Here is the compiled version with the changes I have made... If you would like the source just let me know and I can post that to.

----------


## DigiRev

> Sorry for the double post... Here is the compiled version with the changes I have made... If you would like the source just let me know and I can post that to.


Nice, looks cool.  :Cool:   :Thumb:

----------


## Genovah

Thanks can't wait to see yours  :Smilie:

----------


## minidesigner

Genovah yours looks cool.

----------


## Genovah

Thanks but the credit goes to DigiRev without his source I would be dazed it has tought me a lot about Winsock and now I will be incorperating it in a lot of new projects

----------


## Genovah

I recieved a PM requesting that I post the source code to the client so here it is!

Note: The source has not changed a WHOLE lot since his there is just a few added features I am still working on the rest and not ready to release it yet.

*edit* Sorry typed up the previous message on a work computer then went to upload it and realized that the source was on my home computer (Doh!) So I logged on remotely and here it is

----------


## Genovah

And my newest executeable if anyone is interested... Client only (haven't had enough time to work on the server portion yet still pretty basic.) 

Note: Upon closing the program it will write .txt files to "C:\Program Files\ChatterBox\" to save the settings that you have chosen... just so you are aware..

I'm looking for feedback and ideas to add to the project I already have a list wrote down of some of them. Still a work in progress (Digi is so much better at this then I, haha)

Take care all.

----------


## Philly0494

I made some changes, this has more options as well as a great logging system


Features:


```
Client:
Leave Room
Reconnect
Style Changes
Features - Run, Kill, Calc, Temp

Server:
Announce
Disconnect Clients
Style Changes
Save Chat
View Logs
Clear Logs
Features - Run, Kill, Calc, Temp
```

When you close the server, the logs are updated, so you don't need to press Save Chat everytime

If anyone wants the source code just look below.

----------


## Justin M

Do you know if there is a way to ban or disconnect troublesome members?

----------


## TheBigB

That would be just a matter of finding out which socket the member uses and then sck.Close.
For banning you'd get the .RemoteIP from the user before closing and put that in a 'deny connection' list in the Connection_Request event.

----------


## DigiRev

Exactly what TheBigB said. I'll add it into the server real quick since this update is taking a little longer than I thought.

Will post back soon.

----------


## DigiRev

Ok, this should work. I wrote it really quickly but it should not let them into the room once they are banned.

On the server, right-click the user list to ban a user.

The client also wasn't closing properly so that should be fixed also.

----------


## Philly0494

> Ok, this should work. I wrote it really quickly but it should not let them into the room once they are banned.
> 
> On the server, right-click the user list to ban a user.
> 
> The client also wasn't closing properly so that should be fixed also.


yeah i also fixed the client problem

and i just added a block user function that works both client and server sided, it ignores the user, not disconnects him.

so that will be up soon

----------


## Philly0494

Here it is



```
Client:
Leave Room
Reconnect
Style Changes
*Block User*

Server:
Announce
Disconnect Clients
Style Changes
Save Chat
View Logs
Clear Logs
*Block User*
*Lock User*
```

I got rid of those other, unnecessary features.

you can only block 1 person at a time, same with locking
just right-click a user in the listbox

Blocking: you dont hear the selected person
Locking: nobody hears the selected person

I'll add anything else you guys want me to

----------


## minidesigner

you both have great working models.  digirev i can't wait to see your final version.

----------


## DigiRev

> you both have great working models.  digirev i can't wait to see your final version.


Almost done.  :Big Grin: 

Will be a _huge_ improvement over the first one.

----------


## Philly0494

are you going to put my chat logging system in you new release?

----------


## DigiRev

> are you going to put my chat logging system in you new release?


Yeah I liked your logging feature so I'll put that in there also.  :Smilie:  

If anyone has any more ideas, now is the time to let me know. It's getting pretty close to being done.

----------


## Philly0494

```
Client:
Leave Room
Reconnect
Style Changes
Block User
*Block User Management (Max 3)*

Server:
Announce
Disconnect Clients
Style Changes
Save Chat
View Logs
Clear Logs
Block User
Lock User
*Block User Management (Max 3)*
*Lock User Management (Max 3)*
```

you guys can take this, but im not gonna bother making any more since digirev will do a much better job when he finishes his

----------


## Genovah

Here is my latest I haven't finished everything (no where near going to add a few more features) There are some options in the context menu that are actually not in use yet (Ignore, Global Mute) You will notice under the console I added a 'unban' 'restart server' and 'shutdown server' feature as well as another lstbox with the user names... will finish it up tomorrow and probably work on more features.... let me know what you guys think! Can't wait to see yours digi!

----------


## zynder

Nice one Genovah. Can you add a PM feature server/client? Great effort dude!

----------


## Genovah

> Nice one Genovah. Can you add a PM feature server/client? Great effort dude!


Thank you! I will work on private messaging once I get these other features nailed down. 

Currently I am having a problem with m Global Mute feature its not saving/loading properly perhaps someone could shed some light on where I messed up? I might not be able to find it for the fact that I'm extremely tired and maybe it will be easier later but here it is:


ModChat Code:
Option Explicit
 'Structure to store info about a user.
'Add your own stuff if you want.
Public Type CHAT_USER
    strNickname As String 'Nickname.
    strIP As String 'IP address.
    strBuffer As String 'Received data buffer from this client.
    'Add your own stuff like:
    'strRoomName As String 'For multiple rooms.
    'strTimeConnected As String 'To store what time they connected?
    'All code in the server is based off the info stored here.
End Type
 'An array that contains all info about every user.
'A user's index in this array corresponds to the Winsock control responsible for this connection.
Public udtUsers() As CHAT_USER
 'Max integer value, therefore, max simultaneous connections.
'(Most computers can't handle anywhere near this many).
Public Const MAX_INT As Integer = 32767
 'One main sub that closes the server.
'Should be called before opening the server.
Public Sub CloseServer()
    'Steps:
    '------
    '1. Unload & close all Winsock controls.
    '2. Erase udtUsers() array to clear up memory.
    
    Dim intLoop As Integer
    
    With frmChat
        .sckServer(0).Close 'Close first control.
        
        If .sckServer.UBound > 0 Then
            'More than one Winsock control in the array.
            'Loop through and close/unload all of them.
            For intLoop = 1 To .sckServer.UBound
                .sckServer(intLoop).Close
                Unload .sckServer(intLoop)
            Next intLoop
        End If
    
    End With
    
    'Erase all current users from memory.
    Erase udtUsers
End Sub
 'Finds an available Winsock control to use for an incoming connection.
'You can just copy/paste this code into your chat program if you want.
'Just change "sckServer" to the name of your Winsock control (array).
'And change MAX_INT to max simultaneous connections that you want (it is at top of this module).
Public Function NextOpenSocket() As Integer
    Dim intLoop As Integer, intFound As Integer
    
    With frmChat
        'First, see if there is only one Winsock control.
        If .sckServer.UBound = 0 Then
            'Just load #1.
            Load .sckServer(1)
            .sckServer(1).Close
            NextOpenSocket = 1
        Else
            'There is more than 1.
            'Loop through all of them to find one not being used.
            'If it is not being used, it's state will = sckClosed (no connections).
            For intLoop = 1 To .sckServer.UBound
                If .sckServer(intLoop).State = sckClosed Then
                    'Found one not being used.
                    intFound = intLoop
                    Exit For
                End If
            Next intLoop
            
            'Check if we found one.
            If intFound > 0 Then
                NextOpenSocket = intFound
            Else
                'Didn't find one.
                'Load a new one.
                'Unless we reached MAX_INT
                'which is max number of clients.
                If .sckServer.UBound + 1 < MAX_INT Then
                    'There is room for another one.
                    intFound = .sckServer.UBound + 1
                    Load .sckServer(intFound)
                    .sckServer(intFound).Close
                    NextOpenSocket = intFound
                Else
                    'Server is full!
                    Debug.Print "CONNECTION REJECTED! MAX CLIENTS (" & MAX_INT & ") REACHED!"
                End If
            
            End If
        End If
    End With
    
End Function
 'Returns the upper bounds (UBound) of udtUsers array without an error.
Public Function UBUsers() As Long
    On Error GoTo ErrorHandler
    
    UBUsers = UBound(udtUsers)
    
    Exit Function
    
ErrorHandler:
    
End Function
 'ignore a user.
Public Sub GlobalMuteUser(ByRef Username As String, Switch As Integer)
    Dim l As Long, u As Long
    Dim s As String, strPacket As String
    Dim r As Long
   ' On Error GoTo ErrorHandler
    If Username = "" Then Exit Sub
    s = LCase$(Username)
    u = UBUsers
    If Switch = 1 Then
        For l = 0 To u
            If LCase$(udtUsers(l).strNickname) = s Then
                GlobalMute_Add udtUsers(l).strIP
                Mute_Save udtUsers(l).strIP, 1
                r = l
                Exit For
            End If
        Next l
            AddStatusMessage frmChat.rtbChat, RGB(128, 0, 0), Username & " was muted."
    Else
        For l = 0 To u
            If LCase$(udtUsers(l).strNickname) = s Then
                GlobalMute_Add udtUsers(1).strIP
                Mute_Save udtUsers(l).strIP, 0
                r = l
                Exit For
            End If
        Next l
            AddStatusMessage frmChat.rtbChat, RGB(128, 0, 0), Username & " was un-muted."
    End If
ErrorHandler:
End Sub
 Public Sub KickUser(ByRef Username As String)
    Dim l As Long, u As Long
    Dim s As String, strPacket As String
    Dim r As Long
    On Error GoTo ErrorHandler
    If Username = "" Then Exit Sub
    s = LCase$(Username)
    u = UBUsers
    For l = 0 To u
        If LCase$(udtUsers(l).strNickname) = s Then
            strPacket = "KIK" & Chr$(2) & udtUsers(1).strNickname & Chr$(4)
            r = l
        End If
    Next l
    
    If Len(strPacket) > 0 Then
        SendGlobalData strPacket
        frmChat.sckServer_Close CInt(r)
    AddStatusMessage frmChat.rtbChat, RGB(128, 0, 0), Username & " was kicked."
    End If
ErrorHandler:
End Sub


ModServer Code:
Option Explicit
Public strMuted() As String
Public bolRestart As Boolean
 Public Sub Mute_Save(ByRef IPAddress As String, Switch As Integer)
    Dim intFF As Integer, l As Long, u As Long
    Dim sNextLine As String
    intFF = FreeFile
'On Error Resume Next
'Kill App.Path & "\muted.txt"
'On Error GoTo ErrorHandler
   If Switch = 1 Then
         u = Mute_Ubound
         If u > -1 Then
             Open App.Path & "\muted.txt" For Append As #intFF
                 For l = 0 To u
                     If Len(strMuted(l)) > 0 Then
                         If l < u Then
                             Print #intFF, strMuted(l)
                         Else
                             Print #intFF, strMuted(l);
                         End If
                     End If
                 Next l
             Close #intFF
         End If
         Exit Sub
    ElseIf Switch = 0 Then
        u = Mute_Ubound
        ReDim Preserve strMuted(0 To u)
        If u > -1 Then
            Open App.Path & "\muted.txt" For Input As #intFF
                Erase strMuted
                Do Until EOF(intFF)
                    Line Input #intFF, sNextLine
                    If Not sNextLine = "" Then
                        If Not sNextLine = IPAddress Then
                            strMuted(l) = sNextLine
                        Else
                            strMuted(l) = vbNullString
                        End If
                    End If
                    l = l + 1
                Loop
            Close #intFF
            Open App.Path & "\muted.txt" For Output As #intFF
                Print #intFF, vbNullString
            Close #intFF
            Open App.Path & "\muted.txt" For Append As #intFF
                 For l = 0 To u
                     If Len(strMuted(l)) > 0 Then
                         If l < u Then
                             If Not IPAddress = strMuted(l) Then Print #intFF, strMuted(l)
                         Else
                             If Not IPAddress = strMuted(l) Then Print #intFF, strMuted(l)
                         End If
                     End If
                 Next l
             Close #intFF
        End If
    End If
ErrorHandler:
    Close #intFF
    Exit Sub
End Sub
 Public Sub Mute_Load()
    Dim intFF As Integer
    intFF = FreeFile
    
    Erase strMuted
    On Error GoTo ErrorHandler
    Open App.Path & "\muted.txt" For Input As #intFF
        If LOF(intFF) > 0 Then strMuted = Split(Input(LOF(intFF), intFF), vbCrLf)
    Close #intFF
    Exit Sub
ErrorHandler:
    Close #intFF
    Exit Sub
End Sub
 Public Sub GlobalMute_Add(ByRef IPAddress As String)
    Dim u As Long
    u = Mute_Ubound + 1
    ReDim Preserve strMuted(0 To u) As String
    strMuted(u) = IPAddress
End Sub
 Public Function GlobalMute_IsMuted(ByRef IPAddress As String) As Boolean
    Dim l As Long, u As Long
    u = Mute_Ubound
    If u > -1 Then
        For l = 0 To u
            If strMuted(l) = IPAddress Then
                GlobalMute_IsMuted = True
                Exit For
            End If
        Next l
    End If
End Function
 Public Function Mute_Ubound() As Long
    On Error GoTo ErrorHandler
    Mute_Ubound = UBound(strMuted)
    Exit Function
ErrorHandler:
    Mute_Ubound = -1
    Exit Function
End Function
I am having problems in the Muted_Save portion of the code. The code is truncated so it could fit. Thanks for any help in advance!

----------


## minidesigner

first off explain what mute is to be used for

----------


## Genovah

It prevents the user from speaking what so ever by calling upon a sub to check and see if the user has been added to the mute list the problem is in the Mute_Save sub 

Below this line of code: If switch = 0 then where muted.txt is input into the string sNextLine

sNextLine = strMuted(l) should put the text into the proper string but I get a subscript error. not sure why seeing as the dimensions are set properly as far as I can tell... but as I said earlier maybe its lack of sleep... off to take a nap 

*edit* Fixed... I accidently put an Erase string in by mistake

----------


## psychotomus

Genovah, you should really convert to a database instead of usng text files. it reduces code by a lot =)

----------


## Genovah

I agree but the coding I have done with databases has all been in PHP/SQL... So my knowledge is limited seeing as I didn't do it too much... However if I were to go to a database setup wouldn't the server have to be running Microsoft SQL or another type of database? I am trying to make a server that can be run by any user with minimal to no set up required... once I scratch the public version and make my own I will definetly learn/convert it to DB format

----------


## psychotomus

You can use microsoft access database .mdb files and the querys are the same as if you was using mySQL for the most part so its pretty simple to pick up. If you need an example. i'll post one =)

----------


## Genovah

As long as you don't mind I would be interested in seeing an example

----------


## psychotomus

http://www.vbforums.com/showthread.php?p=3228114 MULTI-USER WINSOCK CHAT USING ACCESS DATABASE

----------


## TheBigB

I once tried to build a chatting system from scratch with databases...
I gave up  :Big Grin: 

But that's quite usually the thing that happens when I start with things from scratch, due to lack of time/patience/coffee and the overflow of laziness/practical problems/the application. 

Anyways,
@psych; that interface looks so familiar, but I don't remember where from...

----------


## Genovah

> http://www.vbforums.com/showthread.php?p=3228114 MULTI-USER WINSOCK CHAT USING ACCESS DATABASE


After reviewing the code and looking at everything I think I am going to go with an access database will make it easier to store all the colors and everything else. Thanks psycho! it was a great idea! BTW do you have groove or another type of messanging service? I would like to add you as a friend if you don't mind.

----------


## Genovah

DB not installed yet but PM feature is complete 
Note: ignore is not fully functional on the client side yet

----------


## DigiRev

Here are a few spoiler screenshots in case you are wondering what it looks like so far...











I have it setup so you can create different "server configurations" with different room lists and settings and load them right from the Server menu so you don't have to set it up every time.

----------


## Genovah

Wow Digi and I thought I was getting somewhere.... *bows to DigiRev*

Good job can't wait to start parsing your code! :P

Are you using a db format or standard .txt files with VB Chat?

----------


## DigiRev

I wanted this to be kind of like mIRC without people having to sign up so there is no db or anything.

Maybe after I release this one I'll make an IM version...

Will post more screenshots soon. File transfers are being a *****

----------


## Genovah

Makes sense to me! Thats kind of what I was going for but then after implementing an admin feature I figure I would be best off going with a db instead of multiple strings identifying admins vs moderators vs regular clients

----------


## Justin M

> Here are a few spoiler screenshots in case you are wondering what it looks like so far...
> 
> 
> 
> 
> 
> 
> 
> 
> ...


Wow that is pretty cool, how did you get the rounded frames in vb 6?

PS: How did you ever get ti so people could change their username color?

----------


## DigiRev

> Wow that is pretty cool, how did you get the rounded frames in vb 6?
> 
> PS: How did you ever get ti so people could change their username color?


Those are normal frames. I'm just using a manifest file for XP style.  :Wink: 

I sent the color along with the nickname when they login. And store this color in the CLIENT UDT on the server side.

When the server relays a chat message to the room, it also sends this color from that user's UDT.

Then I updated the procedure that shows a chat message to set the color of the username to this value.

Sorry, that's the best I can explain it. This thing should be done pretty soon and you can see.

----------


## minidesigner

can't waite looks great

----------


## Genovah

If you are trying to set up a type of buddy list you are going to be better off going with a DB setup... The setup he has resets everything once the program is close I don't see how it would support friends unless everything was set to save to a text file but thats going to be a lot of text files Unless of course you dont mind that the buddy list is reset everytime... and since there is no login password anyone could potentially use that persons nickname so eventhough the person who used that name the first time might be your friend... the next person who uses it may not if you understand what I mean... there is an example if you scroll back to one of the previous pages. It has a buddy list and a DB you might want to check it out to get some ideas.

----------


## minidesigner

actually couldn't you have all of your settings, buddy list, and all that be saved in one text file to reduce the amount.  if organized properly it would work.

----------


## psychotomus

> actually couldn't you have all of your settings, buddy list, and all that be saved in one text file to reduce the amount.  if organized properly it would work.


reduce the ammount of what? I would think having all info in 1 file would make it take more space, seperate txt files would work better if your d oing it that way with all those txt files in there own folder per user.

----------


## minidesigner

actually a txt file really isn't that large of a file especially with the info we're talking about saving in it.  i could be wrong on that i'll have to test the theory but we have txt files at my office, actually the extention is mdf.  okay my bad after looking at them closer they are database files but still they open as text files just with a specific format.  anyway my point is the largest file is 1936 lines, you could use a standard txt file but your right as it would take more code to do than using data access in vb.  sorry for type o's and me not using my brain.

----------


## Genovah

My only point is that say that Fred adds Joe as a buddy... Joe doesn't use the nickname Joe the next time he logs in and instead uses JOEY111 and a guy named Tom logs in as Joe... Unless the server is going to log all the users by IP and determine who the actual buddy is anyone could log in as your "buddy" and you wouldn't know it wasn't them unless you require a password... If you are using the basic VB chat that was created in my opinion (and maybe I am wrong) but, it seems a little silly to be using a buddy list as anyone could login as your buddy and your buddy could login as any other username... That was my only point for using a database in comparison to a text file.. and the basic client side doesn't have get IP addresses for other users from the server so you would be better off doing the buddy list portion server side anyways just like in SIM chat.

----------


## psychotomus

other thing to think about is if you use a txt file say in sim/onlinebuddys.txt

inside that txt file is 150 online buddys. buddy number 83 sign's off. you now have to recreate that txt file everytime someone signs on or off ;]

----------


## DigiRev

Database is the best way.

You could store account information in .txt files. And keep buddy lists/contacts in memory and never save them to file.

You could either have one big text file with all accounts (or INI file), or a separate one for each user (probably not a good idea).

A simple database makes things a lot easier though.

----------


## Milad87

Very nice Job DigiRev... Im looking forward to look at ur finished project...

A nice function to ur chat would be the microphone chat to make users able to talk... Hard to make but it would be nice... good luck :Smilie:

----------


## emyztik

say the users whole friends list is in a database like this: kyle,john,mark
all separated by commas.

how would you determine the users online/offline friends(how to tell which ones are online and offline) and send the online friends, then send the offline ones?

or am i thinking of this totally the wrong way?

----------


## Genovah

If you look at the Sim Chat example there is a column labeld is_online which has either a value of 0 or 1 0 being offline 1 being online that is the way i would do it, it is stored in the users table with the users username and password

----------


## Genovah

Well here is a huge revamp from my previous version. Please let me know if you find any bugs or have any suggestions. Feedback is much appreciated!

If you are trying to use the e-mail feature you will need to edit the SendMail sub and enter your gmail user account information. The only thing that is not functional server side is the chatrooms feature that is still a work in progress. Ignore any foul language in the code it is mostly me talking to myself. The main server is online so feel free to connect if you have questions or want to talk.

Thanks!

----------


## DigiRev

Sorry guys. 2-3 more days (on Monday/Tuesday), and that is the final deadline. If it is not done by then, you can shoot me.  :Smilie: 

I decided to make it IM based, with user registration, database, and contact/buddy list since a lot of people seem to wonder how that is done. I am new to databases in VB myself but I am using the ADO 2.8 library and have most of it working after reading the tutorial in the CodeBank.

The only downside is you will need to register an account for every server you connect to. But I am making the registration as simple as possible, just username/email/password and password recovery question/answer.

Only accounts, contact lists, and ignore lists will be saved in the database. The rest will be done in memory on the server (who is online, offline, etc.).

This is a big project so it might be hard to learn from like this one. I am going to try & keep things as simple as possible, but some things might be done a little harder for the sake of performance.

I hope it will be worth the wait. This will be like a Yahoo! Messenger clone with a lot of the same features.  :Wink:  No voice chat in this release, though. I may do that as an update when I can take the time to sit down with it and make it work. I will also try to post some screen shots soon before it's released.

----------


## Calaf

Hello all.
I was reading the post talking about the techinque you use to ban a client. Well, your proposal was to ban the IP but I have to say that this is not such smart way to ban a client given mostly simply have a dynamic IP so that the banned one has just to disconnect his modem getting a new IP and voila.

I'm talking about this argument to preserve the server and the lobby chat from hackers attach or anyway all those people who wants to annoy or crash the environment. Then my question is: is there a better way to know exactly the source of data from a client in order to ban it definitely?
Of course I'm talking about safety problems.

----------


## DigiRev

You can make your client send a hardware GUID (like hard drive # or something) and then ban that. Or ban an IP range...That is how a lot of anti-cheat software works in games (PunkBuster).

But if you plan to send a hardware GUID or any personal info like that you should warn the user before they use/install your program.

----------


## GDOG34

Or you can have it where when the user "signs up" it uploads there username into a database/file and when that user gets banned you can have a ban list. This way the username cannot be used again becuase it is in the datatbase.

----------


## TheBigB

But that doesn't prevent the user from creating another username

----------


## GDOG34

Yes but the user can just go on a differnt computer and create a new username and get around this. The user also can use ip software that gives them new ip information that hides there orignal one. There is still many go arounds to this...

----------


## TheBigB

But most people wouldn't go that far.
There is no way to make a fool proof ban system.
In most cases an IP ban will be more than enough.

----------


## Calaf

> You can make your client send a hardware GUID (like hard drive # or something) and then ban that. Or ban an IP range...That is how a lot of anti-cheat software works in games (PunkBuster).
> 
> But if you plan to send a hardware GUID or any personal info like that you should warn the user before they use/install your program.



ty Digirev but here my questions:

1) Why should I warn the user? I mean, do you think such actitude is under right?And if it's under right then what the users might do against me?
2) How to get those hardware informations by using Vb?
3) How a client might protect itself from being tracked that way?

ty in advance

----------


## DigiRev

> ty Digirev but here my questions:
> 
> 1) Why should I warn the user? I mean, do you think such actitude is under right?And if it's under right then what the users might do against me?
> 2) How to get those hardware informations by using Vb?
> 3) How a client might protect itself from being tracked that way?
> 
> ty in advance


Anytime that personal information might be sent by your program, you should let the user (and may actually be required by law to tell them but I don't know). Things like PunkBuster which is an anti-cheat system for games tells the user. It is up to you, though.

There is a submission in the code bank to get hard drive serial # (and also some more on www.pscode.com/vb). Some serial #'s can be changed, but the one in the CodeBank gets the one put in there by the hard drive manufacturer which cannot be changed.

There are a few ways. If you use the # that can't be changed then I'm not aware of any way to spoof that.

If you take programs like OlyDbg into account, people can debug/reassemble your program to send off a different hardware ID, which is not actually very hard. Finding ways around that are hard, but there are some programs you can use to help.

----------


## Genovah

Any updates digi? any expected completion date?

----------


## TheBigB

*shoot, shoot*  :Stick Out Tongue:

----------


## DigiRev

I finished it yesterday (Tuesday  :Wink: ). I ran across a few bugs and am fixing those now then gonna package it and upload it...

----------


## psychotomus

post screen shots too =)

----------


## emyztik

is it done yet?

----------


## snortop

he didnt say which Monday, tuesday it where.. lol

I hope it get done soon  :Smilie:

----------


## DigiRev

It is done. Hard drive went dead (I have the worst luck) but thankfully I have everything backed up on DVDs so nothing is lost (except a lot of other stuff but not vbChat).

Thanks for being so patient. It will be worth the wait, though, for sure.  :Wink:  Getting my programs re-installed now, and then I'm going to prepare an installation and make sure everything is in order then I will upload it.

----------


## minidesigner

good luck

----------


## emyztik

3 days later....  :LOL:

----------


## Genovah

Digi are you still alive? Everything going well...? Any new expected release?

----------


## emyztik

DigiRev, what's up with it??

----------


## Aphex

I just spoke to DigiRev. The whole thing is complete but he's having Computer issues (complete system crash) and cannot use it at the moment nor can he access it, obviously.

Give him a bit, guys.

----------


## Neato

Sata cables + Another box = Recovery of data files  :Big Grin:

----------


## guitar

_Everything_ is on that old hard drive, password to my DigiRev account, e-mail address, all my programming stuff, etc. I had that computer since about 1998 so it was just a matter of time before it went wrong...but man...bad timing! I had just created a webpage for it and installation program.  :Mad: 

It will be worth the wait, trust me.  :Wink:  Very similar to Yahoo! Messenger/Skype, etc. so if you ever wondered how a lot of the features in those work, you will get to see soon.

Thanks for being patient.

----------


## TheBigB

Why don't you request a new password?

----------


## yosef_mreh

hi all
how can i use vb6 to get windows password of the login username?

----------


## TheBigB

> hi all
> how can i use vb6 to get windows password of the login username?


Only post in existing threads if your question is relevant to the thread's subject. Otherwise create a new thread.

----------


## guitar

> Why don't you request a new password?


Because the password to my e-mail is on that hard drive also...

----------


## psychotomus

how can you not remember your password? lols.

----------


## minidesigner

so has this just died or what

----------


## minidesigner

so whats going on with this thread

----------


## DigiRev

I'm not dead. I stopped programming for awhile.

I still have the code on a backup drive...if I remember correctly, it's basically done, there was just a bug or two that needs to be fixed.

I'll post it when I get around to it. I forgot about it entirely.

----------


## minidesigner

was looking forward to seeing your final project.  i've used yours and tweeked it to work with some of the programs iwe use in my office.

----------


## emyztik

would be cool to see, you find it?

----------


## josh.rice

I have created a chat program, I hope that you guys like it  :Big Grin:

----------


## josh.rice

vb Code:
Attribute VB_Name = "modRooms"Global frmRooms() As New frmRoomChatPublic strRoomsHide() As String Dim roomIndex As Integer Public Function UbRooms() As Long    On Error GoTo ErrorHandler    UbRooms = UBound(frmRooms)    Exit FunctionErrorHandler:    UbRooms = -1    Exit FunctionEnd Function Sub HandleUserLeavingRoom(Packet As String)'"ULV()Uname()Room<<"If InStr(1, Packet, Chr(2)) > 0 Then    Dim packetDetails() As String    Dim UserName As String    Dim Roomname As String    packetDetails() = Split(Packet, Chr(2))    UserName = packetDetails(1)    Roomname = packetDetails(2)    If RoomsHide_IsHiding(Roomname) = True Then ShowHiddenRoom Roomname    WriteMesssage frmRooms(roomIndex).rtbChat, vbNullChar, UserName & " has left the room.", vbMagenta    RemoveListItem frmRooms(roomIndex).lstRoomUsers, UserName, TrueEnd IfEnd Sub Sub HandleNewRoomUser(Packet As String)'"UJN()Uname()Room<<"If InStr(1, Packet, Chr(2)) > 0 Then    Dim packetDetails() As String    Dim UserName As String    Dim Roomname As String    packetDetails() = Split(Packet, Chr(2))    UserName = packetDetails(1)    Roomname = packetDetails(2)    If RoomsHide_IsHiding(Roomname) = True Then ShowHiddenRoom Roomname    WriteMesssage frmRooms(roomIndex).rtbChat, vbNullChar, UserName & " has entered the room.", vbMagenta    RemoveListItem frmRooms(roomIndex).lstRoomUsers, UserName, True    frmRooms(roomIndex).lstRoomUsers.AddItem UserNameEnd IfEnd Sub Public Sub AddNewRoom()    ReDim Preserve frmRooms(UbRooms + 1)End Sub Sub ShowHiddenRoom(Roomname As String)    Dim x As Integer    For x = 0 To UbRooms        If frmRooms(x).Caption = Roomname Then            frmRooms(x).Show            Exit Sub        End If    Next xEnd Sub Public Sub ShowRoom(strRoomName As String)    Dim u As Integer        u = UbRooms    If u > -1 Then        For roomIndex = 0 To u            If frmRooms(roomIndex).Caption = strRoomName Then                frmRooms(roomIndex).Show                Exit For            ElseIf frmRooms(roomIndex).Caption = "" Then                frmRooms(roomIndex).Caption = strRoomName                frmRooms(roomIndex).Show                AddNewRoom                Exit For            End If        Next roomIndex    End IfEnd Sub Public Function RoomsHide_IsHiding(ByRef Roomname As String) As Boolean    Dim l As Long, u As Long, s As String    u = RoomsHide_UBound    s = LCase$(Roomname)    If u > -1 Then        For l = 0 To u            If LCase$(strRoomsHide(l)) = s Then                RoomsHide_IsHiding = True                Exit For            Else                RoomsHide_IsHiding = False            End If        Next l    End IfEnd Function Public Function RoomsHide_UBound()    On Error GoTo ErrorHandler    RoomsHide_UBound = UBound(strRoomsHide)    Exit FunctionErrorHandler:    RoomsHide_UBound = -1    Exit FunctionEnd Function Public Sub RoomsHide_Add(ByRef Roomname As String)    Dim u As Long    u = RoomsHide_UBound + 1    ReDim Preserve strRoomsHide(0 To u) As String    strRoomsHide(u) = RoomnameEnd Sub Sub HandleWrongRoomPassword(Packet As String)    If InStr(1, Packet, Chr(2)) > 0 Then        Dim packetDetails() As String        packetDetails() = Split(Packet, Chr(2))        MsgBox "The password you used to enter the " & packetDetails(1) & " chat room is wrong. Please retry.", vbExclamation        WriteLog frmMain.rtbLog, "Access denied to the " & packetDetails(1) & " chat room: Wrong Password.", vbMagenta    End IfEnd Sub Sub HandleJoinedRoom(Packet As String)    If InStr(1, Packet, Chr(2)) > 0 Then        Dim packetDetails() As String        packetDetails() = Split(Packet, Chr(2))        ShowRoom (packetDetails(1))        'WriteLog frmMain.rtbLog, NickName & " joined the " & packetDetails(1) & " chat room."    End IfEnd Sub Sub AlreadyInRoom(Packet As String)If InStr(1, Packet, Chr(2)) > 0 Then    Dim Roomname As String    Dim packetDetails() As String    packetDetails() = Split(Packet, Chr(2))    Roomname = packetDetails(1)    WriteLog frmMain.rtbLog, "You are already in the " & Roomname & " chat room."    If RoomsHide_IsHiding(Roomname) = True Then ShowHiddenRoom RoomnameEnd IfEnd Sub Public Sub HandleRoomList(Packet As String)    If InStr(1, Packet, Chr(2)) > 0 Then    'Room Packet format: "RUM()RumName2-Locked-Creator-0-200-joe>        frmChatRooms.lstRooms.ListItems.Clear        Dim strRoomList() As String        Dim strPacketDetails() As String        Dim strRoomInfo() As String        Dim strRoomName As String        Dim isLocked As Boolean        Dim usersInside As Integer        Dim strCreator As String        Dim intMax As Integer        Dim strPass As String        Dim strIcon As String        Dim i As Integer        strPacketDetails() = Split(Packet, Chr(2))        strRoomList() = Split(strPacketDetails(1), vbCrLf)        For i = 0 To UBound(strRoomList()) - 1            strRoomInfo() = Split(strRoomList(i), Chr(3))            strRoomName = strRoomInfo(0)            isLocked = strRoomInfo(1)            strCreator = strRoomInfo(2)            usersInside = strRoomInfo(3)            intMax = strRoomInfo(4)            strPass = strRoomInfo(5)            If isLocked = True Then strIcon = "closed"            If isLocked = False Then strIcon = "open"            With frmChatRooms.lstRooms.ListItems.Add(, , strRoomName)                .SmallIcon = strIcon                .SubItems(1) = usersInside                .Tag = intMax & Chr(2) & strPass                If strCreator = Nickname Then                    .bold = True                    .ForeColor = vbBlue                End If            End With        Next i    End IfEnd Sub Sub HandleRoomCreatedSuccessfully(Packet As String)    If InStr(1, Packet, Chr(2)) > 0 Then        'RCT()roomname()sender()Message<<        Dim packetDetails() As String        packetDetails() = Split(Packet, Chr(2))        MsgBox "The room " & packetDetails(1) & " has been successfully created.", vbInformation    End IfEnd Sub Sub SendRoomMessage(Roomname As String, Message As String)    Dim Packet As String    Packet = "RCT" & Chr(2) & Roomname & Chr(2) & Message & Chr(4)    SendData PacketEnd Sub Sub ReceiveRoomMessage(Roomname As String, Sender As String, Message As String)    If Sender = Nickname Then Exit Sub    If CheckIfUserIsBlocked(Sender) = True Then Exit Sub    Dim i As Integer    If RoomsHide_IsHiding(Roomname) = True Then ShowHiddenRoom (Roomname)    For i = 0 To UbRooms        If frmRooms(i).Caption = Roomname Then Exit For    Next i     WriteMesssage frmRooms(i).rtbChat, Sender, MessageEnd Sub Sub HandleRoomMessage(Packet As String)    If InStr(1, Packet, Chr(2)) > 0 Then        'RCT()roomname()sender()Message<<        Dim packetDetails() As String        packetDetails() = Split(Packet, Chr(2))        ReceiveRoomMessage packetDetails(1), packetDetails(2), packetDetails(3)    End IfEnd Sub Sub HandleRoomUserList(Packet As String)'On Error Resume Next    '"RUS()RoomName()User1Name>>User2Name>>User3Name<<    If InStr(1, Packet, Chr(2)) > 0 Then        Dim packetDetails() As String        Dim Roomname As String        Dim roomUsers() As String        Dim i As Integer        packetDetails() = Split(Packet, Chr(2))        Roomname = packetDetails(1)        roomUsers() = Split(packetDetails(2), vbNewLine)        For x = 0 To UbRooms            If frmRooms(x).Caption = Roomname Then Exit For        Next x        For i = 0 To UBound(roomUsers())            If Not roomUsers(i) = "" Then                RemoveListItem frmRooms(x).lstRoomUsers, roomUsers(i), True                frmRooms(x).lstRoomUsers.AddItem roomUsers(i)            End If        Next i    End IfEnd Sub

----------


## emyztik

progress?

----------


## IcyStorm

I dont know how you guys did it but for a noob like me i need to bring a whole dictionary of codes and their meanings and how they work. Any ways I Want to know if there is Any Update on this thing cause I want to examine the code a lot to know better of this codes. 





And For The chat program I am thinking if you could add their profile pics when on pm.

Hoping For the finished version. Good Luck!

----------


## emyztik

progress now?

even if it is not complete DigiRev, release it  :Stick Out Tongue:

----------


## IcyStorm

Maybe his busy right now or somethings wrong with his computer...

But Dont lose Hope(not the cigarettes) he will release the final version we all are waiting for.
But please release it As soon as possible.

----------


## emyztik

meh..

----------


## yyxc819

DigiRev 

Please give some news, are you OK?

----------


## DigiRev

I've been really busy and had to take a long hiatus from programming all-together.

I'm updating this project (well, actually started from scratch) so it will have a lot of new features (custom chat rooms, users can be in multiple rooms, password-protected rooms, etc.). This will hopefully hold you over until I finally finish the instant messenger, which had a lot of nasty bugs so I had to rewrite most of it.  :Sick: 

Not to sound like I'm bragging, but the instant messenger will probably be the best one released that I'm aware of in VB6, even though there are tons of good ones on www.pscode.com. There are really tons of features...

Anyway, updated project will be posted soon and following, the instant messenger.  :Thumb:

----------


## DigiRev

Here's just a few screen shots of the client... it's going to be a tabbed-based client, and function like FireFox, where each room you're in has its own tab.

There's also file transfers, and other stuff.

----------


## GDOG34

Cool! Im intrested in seeing how this comes out!

----------


## DigiRev

It's almost done.  :Big Grin: 

I had to remove the screenshot of the file transfers window, but it looks & functions like FireFox's download manager.  :Wink: 

Also, I might have to wait for webcam features since I need to find mine to be able to test it.

Another feature I'm adding is protocol support, so you can click a link in a web browser like: vbchat://ServerIP:Port and it will automatically launch the program and connect to the server.

----------


## IcyStorm

Cool!!!
More than I expected.
Never thought of something like thing. I thought it would be simple. Maybe you could add a skin feature/themes wherein you can change skins/themes that you want and also make your own.

----------


## AnDa

Look like a great project
Any updates?

----------


## cinaed666

Hi, I've been tracking this thread for some time now..
I'm really looking forward to the new version.. any updates?

----------


## DigiRev

It's almost done now. I had to start over some time ago, but I'm still working on the version shown in the screenshots.

I lost interest in this project awhile ago but still getting it done because I promised.  :Wink:  Not sure how many updates I'll do to it once this next one is released, but that's why it's open-source, right?  :Wink:  It will have a lot of features in it anyway.

----------


## RoflItsK

Hey this was a great program, I added private messages, banning, kicking and muting within a half hour, its so easy to add more functions and its very user friendly.

----------


## DigiRev

> Hey this was a great program, I added private messages, banning, kicking and muting within a half hour, its so easy to add more functions and its very user friendly.


Thanks.  :Smilie: 

That was the goal: to make it easy to add/modify.

Hopefully this update, while it has a bunch of features and is completely different, will still be easy enough to modify and change stuff.

----------


## nazmiqasem

> Hey this was a great program, I added private messages, banning, kicking and muting within a half hour, its so easy to add more functions and its very user friendly.


plez upload source code server+ client


thanks

----------


## nazmiqasem

hi guys

someone can developed more mod like :

private messages + buzz
avatar
banned
ignore
smiles
fonts type+ size + color
admin can create rooms
banned words
upload files share




thanks

----------


## ohailo

i think its only work in a single computer not multi...?right? just like in your attachment pictures...and tyr'd it also but it's not working if u prefer to user it on other computer to other computer..sorry but i am not perfectly sure about this..it just my theory and my expirement explanation...

----------


## Condomx

lol..when you connect,you must change the ip address in the corresponding ip address and port of the server who host that thing..ok.? like if the IP ADDRESS of the server is 10.0.0.9 and the server port is 123456 then you must put that IP ADDRESS and server port to the box so that you could connect...just like what i did.

----------


## Condomx

nice!,simple but full of learnings..

----------


## itzviper

DigiRev you forget about this thread again!?

----------


## CodeBlackRed

hey... can i ask a multi user chat using vb6 that does not use modules?? i'm working on a chat room that does not use modules... client side and server side...  :Smilie:

----------


## Condomx

oh jesus... when could this project will be release.?

----------


## Arispan

Hey DigiRev,

You can can upload the project here and we will fix the bugs (those that we can).  :Wink:

----------


## emyztik

progress?

----------


## Condomx

no respond from him ..as he said he is out in programming at the moment,maybe at the moment means 5 years after or forever for simplicity

----------


## Arispan

Digirev??????????????  :wave:  Have you forgotten how to program in vb6 ?  :Smilie:

----------


## emyztik

no progress yet i see

----------


## killo

what if I'm using this program behind a router where I'm not allowed to change the router settings to do port forwarding, at university for example.
There must be some way to do it without changing the router settings, after all, you don't need to change your router settings when you use MSN or anything.

----------


## minidesigner

you don't have to mess with theprot forwarding with msn because you are not the host.  you only have to port forward if someone outside your router is going to be using your chat system.

----------


## M

Great Replies
Here is Messenger Im Working on it
Webcam Support
VB Support
Room
Private IM



But I Just Afraid From 1Thing :Frown: 
I Think If Users Grows up to 5000! Server Cant Handle it!
Which Language is Good For Writing Server?
VB6 is Poor For Server?

----------


## danecook21

Why did you hijack a thread that was created 3 years ago to post a screenshot of your program?

----------


## paki42o

i want to know how can i save chat? i mean when ppl chat with tht program all gona be save when i admin login can view all chat wat ever thy chat in day user etc... if someone can help please share

----------


## minidesigner

if i'm reading what your asking correctly when you look at the original server console you see all the chat that there has been since you have been running it..... and you have the option i believe to save the chat to a file from the console if you want it to auto save the chat if i remember correctly you will have to program that yourself.  i had to tweek the program myself to make the original work for me.

----------


## paki42o

i asked a friend same q he told me i have to make data base for save chat etc... so i have to know php code:-s
i got no idea about php lol so im not gonna coded: :Mad: 
thanks for reply

----------


## minidesigner

if i can find the code i did i will post it tomorrow

----------


## M

hijack?
I Just want to Ask a Question in this post[because most of those peoples come here! Know about Multi User Chatting Problems...! And U Say Why did u hijack...?
lol
Must of Guys post Screenshot! so is it problem?

----------


## M

> i asked a friend same q he told me i have to make data base for save chat etc... so i have to know php code:-s
> i got no idea about php lol so im not gonna coded:
> thanks for reply


Why u use php?
U can store ur data in db with vb


```
Public dB As New ADODB.Connection

Sub OpenDB()
ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=mdbAccess.mdb;DefaultDir=" & App.Path & ";UID=;PWD="  ' mdbAccess is ur database name! i save mdbAccess.mdb in my Program path

dB.ConnectionString = ConnectionString
dB.ConnectionTimeout = 10
dB.Open
End Sub
```


and with this code[below] u can Save ur Chat Archives... in DB


```
Function AddMessageArchive(Username As String, Message As String) As Boolean
Dim rs As New ADODB.Recordset
rs.Open "Ranking", dB, adOpenKeyset, adLockOptimistic 'Ranking is ur table in db file
With rs
    .AddNew
    !Username = Username
    !Message = Message
    Err = 0
    .Update
    If Err <> 0 Then
        AddRankInfo = False
        Exit Function
    End If
End With
AddMessageArchive = True
End Function
```

I HOpe U Got What I Say:-s

----------


## BPrashanthVB

Yu could use OLEDB provider for speed while archiving messages.

----------


## damselindistress

Here i come.. New to vb6.... 
I used the pretty cool Digirev's App. Gonna need help to work on it for my Term Project  :Smilie: 
Digi's work was very much helpful...got the basic stuff..
Sweet proj :Smilie:

----------


## Aaron02

Digi

I'm trying to test your chat project (V 1 first file), but on my client-side pc it asked for the RICHTX32.OCX.
So I installed the file, and registered it using REGSVR32.  My server side on a different pc operated perfectly.

The Client side still can't find the OCX, any suggestions?

----------


## minidesigner

copy from the server machine and place in the correct folder should work then

----------


## minidesigner

sorry i been away

----------


## VB Client/Server

> Well here is a huge revamp from my previous version. Please let me know if you find any bugs or have any suggestions. Feedback is much appreciated!
> 
> If you are trying to use the e-mail feature you will need to edit the SendMail sub and enter your gmail user account information. The only thing that is not functional server side is the chatrooms feature that is still a work in progress. Ignore any foul language in the code it is mostly me talking to myself. The main server is online so feel free to connect if you have questions or want to talk.
> 
> Thanks!


I use some part of code from post 132...
My question is how to modify server side code to accept only 1 connection at time ?

So that next client will wait until first client disconnect's...

----------


## amosroy111

hi there DigiRev.. im a new memberhere in vbforums and i just want to ask you a question....

how can we add kick user function in the first project you make

----------


## ZackVL

It can be used for chatting with another computer????

----------


## gaouser

omg its realy good but i convert it to .net using vs2008 and fix the errors,server worked but client cant send message in users list box get +1 when i send something and it makes spam only client but im gonna make only server can speak

----------

