The Little Guy Posted August 8, 2010 Share Posted August 8, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/210102-chat-server/ Share on other sites More sharing options...
l4nc3r Posted August 8, 2010 Share Posted August 8, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/210102-chat-server/#findComment-1096496 Share on other sites More sharing options...
The Little Guy Posted August 8, 2010 Author Share Posted August 8, 2010 If I do it using a single port, how do I make private chats (one-on-one), and chat rooms? Quote Link to comment https://forums.phpfreaks.com/topic/210102-chat-server/#findComment-1096513 Share on other sites More sharing options...
greatstar00 Posted August 8, 2010 Share Posted August 8, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/210102-chat-server/#findComment-1096514 Share on other sites More sharing options...
The Little Guy Posted August 8, 2010 Author Share Posted August 8, 2010 What is a channel? Is it a Chat? Quote Link to comment https://forums.phpfreaks.com/topic/210102-chat-server/#findComment-1096515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.