Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to create a multiplayer chat
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Chimaera




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: 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.
Tony




PostPosted: Mon Oct 20, 2003 4:50 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Mazer




PostPosted: Mon Oct 20, 2003 4:56 pm   Post subject: (No subject)

really? well, never mind my answer then Razz
Dan




PostPosted: Mon Oct 20, 2003 9:57 pm   Post subject: (No 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
arhamz




PostPosted: Thu Dec 18, 2003 11:23 pm   Post subject: (No 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
arhamz




PostPosted: Thu Dec 18, 2003 11:24 pm   Post subject: (No 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
Tony




PostPosted: Thu Dec 18, 2003 11:37 pm   Post subject: (No 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
jamilv




PostPosted: Mon Jan 19, 2004 1:42 pm   Post subject: (No subject)

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




PostPosted: Mon Jan 19, 2004 3:07 pm   Post subject: (No 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.
DanShadow




PostPosted: Mon Jan 19, 2004 5:03 pm   Post subject: (No 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.
Andy




PostPosted: Mon Jan 19, 2004 5:05 pm   Post subject: (No subject)

you'll have to use flexible arrays of records
icemaster




PostPosted: Mon Jan 19, 2004 5:27 pm   Post subject: (No 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
ArchAngel16




PostPosted: 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
icemaster




PostPosted: Tue Jan 20, 2004 12:22 am   Post subject: (No 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)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: