Jump to content

Chat Server


The Little Guy

Recommended Posts

I am not sure how I should go about doing this. I have a server that has a chat server on it, people register an account and then have access to this chat server from their application. To initially connect to it, they need a game id and game stamp (kind of like a username/password for the game). I don't want chats from one application to display in another users application. When I created this chat server it was for another purpose, and could only support about 64,510 different chats since each chat ran on its own port. For my current purpose it is a little different some applications can have 1 - 10 chats going at once per user using the application. Say their is 100 people using the application and each is using 5 - 10 different chat windows. With 100 users on at the same time all chatting, that can get up to 1,000 different ports being used. I don't want that, because say there are 100 applications also using chat, that is about 100,000 different ports, and I am pretty sure you cant have 100,000 ports. So! I need a way to make a chat server, any ideas on how I could do this with my php?

 

need more information? please ask!

Link to comment
Share on other sites

I take it your using PHP sockets?  You might want to read up on non-blocking vs blocking sockets.  Assuming you're in blocking mode now, you'd want to switch it over to non-blocking mode and accept all chat information through a single port.

 

Lol yeah; you don't want to create a new socket over a new port for every chat.

Link to comment
Share on other sites

u need to learn pointer, in c++, cause i take this as example

 

use classes ie: channel (class name)

channel points to each user

so, channel has

channelStarter->user1 -> user2 -> user3 (-> means pointer, after user 1, there is a next pointer, to go to next user)

kind of like a chain

 

 

user class:

user contains a property pointer, it points back to the current channel

 

when u send message

user.get channel

for each users in channel, message.send

 

so, in server, u have 2 or more channel classes

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.