Multithread Chat-Server in c
-
Hey everybody, i want to create a chatserver by using c on a windows operating system. The clients should have something like a chatroom. But my problem is that i haven't any idear how to do it that every client get a own thread. I have already looked after codes on google but i couldn't find anything which runs in dev c on windows. Can somebody tell me how and where i have to create the threads? after accept or before?! This is the code of my server but without any threads.
#pragma hdrstop
#pragma argsused#include
#include
#include
#include
#include#define ausgabe_len 200
#define BUF_LEN 1000
// ===========
// | SERVER |
// ===========
void main()
{
WORD Version = MAKEWORD(1, 1);
WSADATA Data;
SOCKET s_sock, c_sock;
struct sockaddr_in server, client;
int len, flag,i,pos;
char ausgabe[ausgabe_len],buffer[BUF_LEN];
int ausgabe_groesse;// Init Vars
pos = 0;
for(i=0; i