
-----------------------------------
Chimaera
Mon Oct 20, 2003 1:48 pm

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?

-----------------------------------
Mazer
Mon Oct 20, 2003 4:49 pm

Re: How to create a multiplayer chat
-----------------------------------
is it limited to 1 client : 1 host?

Yes it is.

-----------------------------------
Tony
Mon Oct 20, 2003 4:50 pm


-----------------------------------
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.

-----------------------------------
Mazer
Mon Oct 20, 2003 4:56 pm


-----------------------------------
really? well, never mind my answer then  :P

-----------------------------------
Dan
Mon Oct 20, 2003 9:57 pm


-----------------------------------
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.

-----------------------------------
arhamz
Thu Dec 18, 2003 11:23 pm


-----------------------------------


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
Thu Dec 18, 2003 11:24 pm


-----------------------------------


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
Thu Dec 18, 2003 11:37 pm


-----------------------------------
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:

-----------------------------------
jamilv
Mon Jan 19, 2004 1:42 pm


-----------------------------------
can someone submit the source or sumthing for a more than 1 on 1 chat?

-----------------------------------
shorthair
Mon Jan 19, 2004 3:07 pm


-----------------------------------
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
Mon Jan 19, 2004 5:03 pm


-----------------------------------
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
Mon Jan 19, 2004 5:05 pm


-----------------------------------
you'll have to use flexible arrays of records

-----------------------------------
icemaster
Mon Jan 19, 2004 5:27 pm


-----------------------------------
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
Mon Jan 19, 2004 5:47 pm

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
Tue Jan 20, 2004 12:22 am


-----------------------------------
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 :D  :shock:  :shock:  8)

-----------------------------------
DanShadow
Tue Jan 20, 2004 8:44 am


-----------------------------------
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.  :D

-----------------------------------
icemaster
Tue Jan 20, 2004 10:59 am


-----------------------------------
i have exams too . . . not to mention an annoying physics exam this friday :shock:  :x

-----------------------------------
Andy
Tue Jan 20, 2004 11:58 am


-----------------------------------
i dont have exams

-----------------------------------
rk_rkade
Sun Apr 11, 2004 1:52 pm


-----------------------------------
:oops:  hey guys, thanx for the tips, i've learned a lot from this site... but im confused now.......
wat do u mean by
  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
