Author |
Message |
Chimaera
|
Posted: 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
|
|
|
Mazer
|
Posted: 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
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Mazer
|
Posted: Mon Oct 20, 2003 4:56 pm Post subject: (No subject) |
|
|
really? well, never mind my answer then |
|
|
|
|
|
Dan
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
jamilv
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: Mon Jan 19, 2004 5:05 pm Post subject: (No subject) |
|
|
you'll have to use flexible arrays of records |
|
|
|
|
|
icemaster
|
Posted: 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
|
Posted: 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
|
Posted: 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 8) |
|
|
|
|
|
|