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.
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.
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"?
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"?
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.
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.
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.
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. It will be up sometime tomorrow afternoon/evening.
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?
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.
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.
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 =]
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?
Wow, I haven't been in here in forever. 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.
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.