# Socket not connecting outside of Flash?

**URL:** <https://forum.kirupa.com/t/socket-not-connecting-outside-of-flash/296299>\
**Category:** flash\
**Created:** [September 12, 2009, 9:52pm UTC](https://forum.kirupa.com/t/socket-not-connecting-outside-of-flash/296299 "2009-09-12T21:52:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexWD](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@AlexWD](https://forum.kirupa.com/u/AlexWD)\
**Post date:** [September 12, 2009, 9:52pm UTC](https://forum.kirupa.com/t/socket-not-connecting-outside-of-flash/296299/1 "2009-09-12T21:52:34Z")

</div>

I was just doing some testing using PHP sockets and Flash. I used several things, one thing is this tutorial: [http://www.kirupa.com/developer/flash8/php5sockets\_flash8.htm](http://www.kirupa.com/developer/flash8/php5sockets_flash8.htm) . I have the server running, and when I run the swf via Flash it connects fine. But when I run it from the browser it can’t connect… Because that Tutorial is in AS2, I also wrote a quick client to connect with AS3, but I’m having the exact same problem… it only connects if I run it through flash.

Here’s an example of the basic code:

```auto
var s:Socket = new Socket('my IP', 5445);
s.addEventListener(ProgressEvent.SOCKET_DATA, getData);

function getData(e:ProgressEvent):void
{
	var d:String = s.readUTFBytes(s.bytesAvailable);
	serverResponse.text = d;
}
s.writeUTFBytes("Hello
");
s.flush();

```

This is just for testing… but again it should return the server’s response and put it inside “serverResponse” (dynamic text field), but it only works when I run it through flash.
