The Little Guy Posted February 28, 2010 Share Posted February 28, 2010 I have a chat server, and I am trying to figure out the best way to handle a one on one conversations between two people. So if I have 2 different conversations going (4 people). I don't want to let one group see the other groups conversation, and vise versa. Currently the UI, is a flash file with an input box and conversation box. Any suggestions how I can/should handle the information? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/ Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 Would I want to create a new socket for each conversation, and only allow those in the conversation to connect to that socket? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020255 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 maybe assigning each conversation a different port might do it. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020257 Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 hmm... didn't think of that... how many ports can I use, do you know off the top of your head? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020261 Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 oo, found this: The Dynamic and/or Private Ports are those from 49152 through 65535 here: http://www.iana.org/assignments/port-numbers Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020263 Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 oh... is there a way to check if a port is available? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020264 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 As many as you want as long as you dont collide with other apps. staying way up in the unregistered range like 60,000-65,000 should be OK. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020268 Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 To save a resource in a database, would I save this: Resource id #6 into a varchar field? then when the second person connects to a particular person, check the database to see what the resource is, and then search the array for a particular resource... so only those two talk. Would this work, or even make sense? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020283 Share on other sites More sharing options...
trq Posted March 2, 2010 Share Posted March 2, 2010 You cannot store a resource in a database. Hell, you can't even save them within a session. Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020285 Share on other sites More sharing options...
The Little Guy Posted March 2, 2010 Author Share Posted March 2, 2010 Im starting to thing that it may be best to have a server, that starts up another program. A main one to listen for new connections, and when one comes it decides if this is a new conversation, or joining of a current one... If it is a new conversation, dispatch a new sub server on its own port. If it is joining a current one, change the current connection port. sound like a better way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020286 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 A resource is not storeable. Why are you even seeing a resource id in output, if you are you need to pass that var on to something else to get anything meaningful like data. How did you get the resource id? What I would do is to assign a port to a pair and put it into their SESSION. Although I've never done it I think that should keep the conversations separate. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/193712-one-on-one-conversations/#findComment-1020293 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.