Author Topic: Need help making an online chat system in C#  (Read 1139 times)

Here is what I have

I would like to know how to make an online chat system.

I was going to make it the unofficial chat system for blockland, but I should probably make it for other things too.


Why not just use IRC?
I want to learn how to communicate with apps and the server/website though.

first important step is to set up a server application with handles each connection on its own thread

you should have a client(as many as you need) and a single server
use winsock

inside the server
set up a listening socket, and a connection socket.

make that listening socket loop forever, and when it gets a connection send it to the connection socket on its own thread
after that, on the same thread(new one), make it so that all it does is take in packets from a connection and distribute it to other connected clients.

on the client side just make it connect to the server, send in packets and let the server do it's job, + let the server connect to you so you receive other messages

3 clients, 1 client sends message to server, server distributes a clone of the message to all the other clients and deletes it afterwards

app should no doubt be multi-threaded

first important step is to set up a server application with handles each connection on its own thread

you should have a client(as many as you need) and a single server
use winsock

inside the server
set up a listening socket, and a connection socket.

make that listening socket loop forever, and when it gets a connection send it to the connection socket on its own thread
after that, on the same thread(new one), make it so that all it does is take in packets from a connection and distribute it to other connected clients.

on the client side just make it connect to the server, send in packets and let the server do it's job, + let the server connect to you so you receive other messages

3 clients, 1 client sends message to server, server distributes a clone of the message to all the other clients and deletes it afterwards

app should no doubt be multi-threaded
I have looked all of this up and I still cannot figure out how to put the code in the app for it to connect to the website.

I also have the server sided issue too, I cannot figure out where that goes too..

ok nevermind i see what you're trying to do and i don't know how. i thought you just wanted a simple tcp connection between a few computers.

also you're trying to connect to the blockland website? why?

Well, I would like it to connect to a website, and then when other people connect to it they can chat message.

I wanted to do this because I want to learn some C# (Or C++) to use internet objects and contact each other client.

well that's out of my knowledge because i never worked with websites. sorry

I can help but I'm a little confused on what you're trying to do. You're trying to make a webchat interface for a server you write in C#? Or output all chat logs to a website so people can listen in through their browser?

I can help but I'm a little confused on what you're trying to do. You're trying to make a webchat interface for a server you write in C#? Or output all chat logs to a website so people can listen in through their browser?
I am trying to make a webchat interface.

inb4everyonehatesonC#

I wish I was at my dad's house, he works with the web and C# for work.

inb4everyonehatesoncsharp
Some people think I am making things in Unity, I don't like Unity. I'd rather code my own games in c++.

A webchat interface would be almost entirely irrelevant to C#, the only thing you'd write in C# is the server. You'd have to learn up on websockets and JavaScript and host the website off your own PC to get a webchat interface working.

Why not just use IRC?
well, people like me are banned forever from it.

well, people like me are banned forever from it.
How do you get banned from ALL IRC? First, there are loads of different servers, and each of those has loads of different rooms. When you get banned from a room, you're not banned from all IRC.