# Using socket servers to authenticate etc

**URL:** https://forum.kirupa.com/t/using-socket-servers-to-authenticate-etc/270059
**Category:** Uncategorized
**Created:** [September 4, 2008, 7:54pm UTC](https://forum.kirupa.com/t/using-socket-servers-to-authenticate-etc/270059 "2008-09-04T19:54:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CrimsonHEART](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@CrimsonHEART](https://forum.kirupa.com/u/CrimsonHEART)
#### Post date: [September 4, 2008, 7:54pm UTC](https://forum.kirupa.com/t/using-socket-servers-to-authenticate-etc/270059/1 "2008-09-04T19:54:57Z")

</div>

Hey,  
I’ve made a flash game that uses the loadVariables method of getting data. However, I’m looking to make it faster and so I turned my attention to Socket Servers.

I first tried making it in Java, and while I was understanding it, it got pretty complicated, and I hadn’t coded in Java before; so progress was really slow to say the least \>\_\<.  
I gave up for a short while, until I heard you could do the same with PHP. Now, I’m fairly decent at PHP, but I didn’t know it could be coded as a socket server. So I gave it a try, and I’m finding it much easier to code than when I wanted to do the equivalent in Java.

BUT!! - I’m kind of stuck now. What I’ve written is a simple socket server that allows multiple clients to connect, and send messages to each other. I figured if I could make an advanced chat client, than I would understand the features of sockets enough to transfer my turn based game into sockets.

The tasks I need help with understanding are:

**- Authenticating a connection.**  
What I want to be able to do, is to login through a PHP form and add the ID to session. Which I already can do and have done. But the next step comes from, _ **How does the socket server read a clients session? How does it know that the user has logged in?** _

**- Assigning a class to a socket.**  
Say I wanted to give the socket connection things like, screen-name, email address, last login etc. _ **How can I assign a socket connection, to a class that holds this information?** _

**- Security.**  
I know it’s difficult to get anything as secure as we’d all like, but I’m talking about basic security. _ **What possible flaws/doors does a typical newbie socket coder tend to overlook?** _

Any help would be appreciated.  
Thanks again,

- CrimsonHEART
