Computer Science Canada

How to create a multiplayer chat

Author:  Chimaera [ Mon Oct 20, 2003 1:48 pm ]
Post subject:  How to create a multiplayer chat

I'm trying to create a chat program that can have more than 2 people chat in the same way, but I've found examples of only 2 way chats. Is it possible through turing to be able to have multiple connections to the same host or is it limited to 1 client : 1 host? And if possible, how so?

Author:  Mazer [ Mon Oct 20, 2003 4:49 pm ]
Post subject:  Re: How to create a multiplayer chat

Chimaera wrote:
is it limited to 1 client : 1 host?


Yes it is.

Author:  Tony [ Mon Oct 20, 2003 4:50 pm ]
Post subject: 

it is possible.

Here's how you modifly your 2 people chat:

client preaty much stays the same.

host - replace client variable with an array. As soon as you get a connection, increase the counter and listed for the next connection. Listening should be done in a fork so it doesnt stop the server from running.

The structure should be:

client sends message to host - host farwards message to all other online clients.

You'd have to be coumfortable using arrays and keep track of all the different connections.

Author:  Mazer [ Mon Oct 20, 2003 4:56 pm ]
Post subject: 

really? well, never mind my answer then Razz

Author:  Dan [ Mon Oct 20, 2003 9:57 pm ]
Post subject: 

if you are avaced enogth to do net stuff in turing you should porbly go on to c++. the net stuff in turing dose not wrok well and i hae never goten it to wrok great. there are alot better net comands aviable for c++ that wrok very well and are used in lots of oline games.

Author:  arhamz [ Thu Dec 18, 2003 11:23 pm ]
Post subject: 

Quote:


Here's how you modifly your 2 people chat:

client preaty much stays the same.

host - replace client variable with an array. As soon as you get a connection, increase the counter and listed for the next connection. Listening should be done in a fork so it doesnt stop the server from running.


Thats wrong ... cuz the port gets in use after one connection ... and u will need to change the port for the next connection ... which means the other client connected to the server wont know which port should it connect too.. if u change the ports on each connection

Author:  arhamz [ Thu Dec 18, 2003 11:24 pm ]
Post subject: 

Quote:


Here's how you modifly your 2 people chat:

client preaty much stays the same.

host - replace client variable with an array. As soon as you get a connection, increase the counter and listed for the next connection. Listening should be done in a fork so it doesnt stop the server from running.


Thats wrong ... cuz the port gets in use after one connection ... and u will need to change the port for the next connection ... which means the other client connected to the server wont know which port should it connect too.. if u change the ports on each connection

Author:  Tony [ Thu Dec 18, 2003 11:37 pm ]
Post subject: 

what you do is you have couple of "connecting ports" to which the clients try to connect... once a sussesful connecton is established, an available port is reserved for the client and client resieves info with which it reconnects. The temporary port is freed for the next client trying to connect Wink

Author:  jamilv [ Mon Jan 19, 2004 1:42 pm ]
Post subject: 

can someone submit the source or sumthing for a more than 1 on 1 chat?

Author:  shorthair [ Mon Jan 19, 2004 3:07 pm ]
Post subject: 

NO one will give oyu the source , a tem jsut completed it , i had a go and did 90% of it but never had time to finish , it involes making multiple poorts that you assign to users and having 1 host that isues commands to the client software.

Author:  DanShadow [ Mon Jan 19, 2004 5:03 pm ]
Post subject: 

There is a topic in "Turing Submissions" that has an example of a multi-user chat interface. (Client source given, Server executable given.)
Im gonna make an attempt of multi-user chat stuff, then if that works out, ill probably write a tu torial.

Author:  Andy [ Mon Jan 19, 2004 5:05 pm ]
Post subject: 

you'll have to use flexible arrays of records

Author:  icemaster [ Mon Jan 19, 2004 5:27 pm ]
Post subject: 

hmm i guess that team is me and templest
i will post my code very soon lol when i comment it
and then u can make a turorial, although i wish i had seen this forum before so i would'nt of had to think of all that by myself, as i made the multi-client enabled server chat program

Author:  ArchAngel16 [ Mon Jan 19, 2004 5:47 pm ]
Post subject:  Multiplayer Chat

Um... I had my entire Gr 11 programming class try to figure it out we worked for about a week. my classmates and I gave up in frustration and then attempted a 2player pong game damn I wish I had kept that for my final project... I came up with the moronic idea of slots and roulette. I'm such an idiot
-Arch

Author:  icemaster [ Tue Jan 20, 2004 12:22 am ]
Post subject: 

would u get mad if i told u i figured it out in 20 mins? cuz it's true, of course im not trying to brag or n e thing lol Very Happy Shocked Shocked 8)

Author:  DanShadow [ Tue Jan 20, 2004 8:44 am ]
Post subject: 

icemaster...you are bragging, lol. And a good portion of us could figure out how to create a multiplayer chat...but dont have the time, mainly because of Exams and all. But either way, I'd appreciate the code. Very Happy

Author:  icemaster [ Tue Jan 20, 2004 10:59 am ]
Post subject: 

i have exams too . . . not to mention an annoying physics exam this friday Shocked Mad

Author:  Andy [ Tue Jan 20, 2004 11:58 am ]
Post subject: 

i dont have exams

Author:  rk_rkade [ Sun Apr 11, 2004 1:52 pm ]
Post subject: 

Embarassed hey guys, thanx for the tips, i've learned a lot from this site... but im confused now.......
wat do u mean by
Quote:
it is possible.

Here's how you modifly your 2 people chat:

client preaty much stays the same.

host - replace client variable with an array. As soon as you get a connection, increase the counter and listed for the next connection. Listening should be done in a fork so it doesnt stop the server from running.

The structure should be:

client sends message to host - host farwards message to all other online clients.

You'd have to be coumfortable using arrays and keep track of all the different connections.




??????????


can someone please explain this concept to me....thanx


: