Ah ha! There's an idea.  I could use the _SESSION associative array to store information about the current client connection / session (including the socket connection) and perhaps use the filesystem as a global registry accessible across all sessions to put information I need accessible to every session (such as the connection information to the DS).  I'll do more research later and see if this is workable.<div>

<br></div><div>Yes, I will have to wrap the client's communication in HTTP POSTS, but theoretically it's possible.  I'll need to look into your suggestions of WebSockets with PHP more to see the details.</div>

<div><br></div><div>True, this is a hack, but it will be pretty cool if it works.  By the way, the CS web server does run Apache.  Good guess!</div><div><br></div><div>@Jordan: Is there any component you're referring to as missing when you say "too weak a foundation"?  Assuming I can make some function to automatically wrap/unwrap packets from an HTTP POST layer, it could be possible to get decent performance.  Ok, so real time video chatting is probably a bit of a stretch, but who knows...</div>

<div><br></div><div>@SGDC: Sorry for spamming you all; forgot to remove the maillist off the reply all.  I'll keep future communication between those who responded.  </div><div><br></div><div>Thanks again for your help so far.  I'll let you know what I can find.</div>

<div><br></div><div>--Dylan Hutchison<br><br><br><br><div class="gmail_quote">On Mon, Sep 17, 2012 at 1:28 PM, Jordan Scales <span dir="ltr"><<a href="mailto:scalesjordan@gmail.com" target="_blank">scalesjordan@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>You'll want to use WebSockets. However, I don't see PHP as a good candidate for a real-time web communications. I guess since you need to operate within what the servers "allow" you to do, you're stuck with it.</div>

<div><br></div><div>But everything you're saying here has already been done in the form of web sockets. As far as their application with PHP goes, Tyler's better-suited to answer that question. I've worked a bit with WS+Node, but never PHP.</div>

<div><br></div><div>Otherwise you'll need this series of transactions stateful, with some session variable wizardry (which seems like the road you're heading down now), but that seems far too weak of a foundation to serve as a proxy. </div>

<div><br></div><div>/$.02</div><div>Jordan</div><br><div><div><div class="h5"><div>On Sep 17, 2012, at 12:59 PM, Dylan Hutchison <<a href="mailto:dhutchis@stevens.edu" target="_blank">dhutchis@stevens.edu</a>> wrote:</div>

<br></div></div><blockquote type="cite"><div><div class="h5"><div>Hi there Tyler, Christopher and Michael,</div><div><br></div><div>Thanks a lot for responding so quickly!  I've coded only perhaps 30 lines of PHP i my life, so your advice will be great to determine how feasible this is.  I attached a picture with the traditional PHP setup on top and my idea on the bottom. </div>



<div><br></div><div>In the standard PHP web server paradigm, the browser makes a connection, the PHP server runs the PHP script of the site which generates HTML output, and the web server sends the HTML response to the client browser.  The interaction is one-shot; there's no opportunity for continued data transfer / intreraction (whether started by the browser to the server or started by the server to the browser) in the same php session.  The browser could, say, reload the page, but that would run the php script again in an independent session.  <b>Key goal</b>: continuous, asynchronous two-way data transfer between the browser and server in the same run of the php script.</div>



<div><br></div><div>Idea 1: if it's possible to use some kind of server-side static variables in the sens that I can store data and use/access it between php sessions, this would help a great deal.</div><div>Idea 2: AJAX exists for the browser to send data to the server and get a response back asynchronously without reloading the page.  Likewise, HTML 5 Server-Side events exist for the server to send data to the browser asynchronously (assuming browser support).  Can I leverage these two technologies here with php?</div>



<div><br></div><div>Use case: did you know that any student can host files on their linux lab account accessible to the outside world?  You just need to create a public_html folder in your home directory and put in HTML or PHP files in there.  Check this out: <a href="http://www.cs.stevens.edu/~dhutchis/tb.php" target="_blank">http://www.cs.stevens.edu/~dhutchis/tb.php</a></div>



<div>So my idea is to allow any student to host their own server of any type (imagine Vent, Minecraft, regular file server, streaming video, you name it) by using the PHP hosting capability of the CS web server as a proxy.  </div>



<div><ol><li>Desktop server on campus (call it DS) connects to /blah.php (call it WS=webserver), and authenticates.  The PHP server stores the IP address and port of the DS that the DS has open for incoming connections.</li>



<li>Client computer (call it CC) sends a browser HTML request to WS.  (The WS prompts for authentication.  CC provides it.)</li><li>The WS opens a TCP/IP socket connection to the original DS (whose connection information it retained) and forwards data from the CC to the DS.  Similarly, it forwards data from the DS sent back to the WS to the CC (assume the WS can distinguish what data is intended for what CC).  Thus, the WS becomes a proxy.  </li>



</ol><div>Step 3 needs to be accomplished using forks, execs, more socket connection opening, cookies, local storage, ... whatever technology/technique it takes so that it can maintain that open socket connection to the DS for the duration that the CC wants to talk.</div>



</div><div><br></div><div>Alternative 1: Use UDP instead of TCP.  Then it might be ok to close a socket connection and open another one; not sure. I'd like to avoid this if possible.</div><div>Alternative 2: Have the WS open 2 sockets; 1 to the DS and another to the CC, providing the CC provides information about a port it has open and listening for incoming connections.  This may work well if the WS can fork up a new process which handles the 2 sockets and doesn't end/die until the CC and DS are done indirectly talking.  This may make the proposal much easier, but it's still be nice to avoid because it requires the CC have an open port.  We should ideally use the connection the CC makes when it sends a browser request to the WS.</div>



<div><br></div><div>So let me know what you think, whether this sounds stupid or not.  I know you guys have your own things to do, but if we can determine that such a setup is possible, I will learn the PHP to do it (hopefully starting at resources you'll point me toward).  Thanks a bunch and I'm looking forward to seeing what you think.</div>



<div><br></div><div>Regards,</div><div>Dylan Hutchison</div><br><br><div class="gmail_quote">On Mon, Sep 17, 2012 at 9:34 AM, Tyler Romeo <span dir="ltr"><<a href="mailto:tylerromeo@gmail.com" target="_blank">tylerromeo@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hey,</div><div><br></div><div>Feel free to shoot me an email. PHP is one of my primary development languages.</div>



<br clear="all"><div><b>--</b></div><b>Tyler Romeo</b><div>Stevens Institute of Technology, Class of 2015</div>

<div>Major in Computer Science</div><div><a href="http://www.whizkidztech.com/" target="_blank">www.whizkidztech.com</a> | <a href="mailto:tylerromeo@gmail.com" target="_blank">tylerromeo@gmail.com</a>
</div><br>
<br><br><div class="gmail_quote"><div>On Mon, Sep 17, 2012 at 7:21 AM, Dylan Hutchison <span dir="ltr"><<a href="mailto:dhutchis@stevens.edu" target="_blank">dhutchis@stevens.edu</a>></span> wrote:<br></div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

Hey folks,<div><br></div><div>Are any of you PHP gurus out there, or do you happen to know someone with a wide knowledge of PHP?  I have an idea for hosting a server in the Stevens network accessible from outside the network involving PHP; I would love to bounce it off you and see if it's plausible.  If it works, it could be really useful for the Stevens campus.  Shoot me an email if you know some PHP or are interested.</div>







<div><br></div><div>Thanks,</div><div>Dylan Hutchison</div>
<br></div></div><div>_______________________________________________<br>
SGDC mailing list<br>
<a href="mailto:SGDC@lists.stevens.edu" target="_blank">SGDC@lists.stevens.edu</a><br>
<a href="https://lists.stevens.edu/cgi-bin/mailman/listinfo/sgdc" target="_blank">https://lists.stevens.edu/cgi-bin/mailman/listinfo/sgdc</a><br>
<br></div></blockquote></div><br>
</blockquote></div><br>
</div></div><span><all.jpg></span>_______________________________________________<div class="im"><br>SGDC mailing list<br><a href="mailto:SGDC@lists.stevens.edu" target="_blank">SGDC@lists.stevens.edu</a><br><a href="https://lists.stevens.edu/cgi-bin/mailman/listinfo/sgdc" target="_blank">https://lists.stevens.edu/cgi-bin/mailman/listinfo/sgdc</a><br>

</div></blockquote></div><br></div></blockquote></div><br></div>