# Socket connection

**URL:** <https://forum.kirupa.com/t/socket-connection/266898>\
**Category:** Uncategorized\
**Created:** [July 25, 2008, 9:51am UTC](https://forum.kirupa.com/t/socket-connection/266898 "2008-07-25T09:51:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anurag\_c](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@anurag\_c](https://forum.kirupa.com/u/anurag_c)\
**Post date:** [July 25, 2008, 9:51am UTC](https://forum.kirupa.com/t/socket-connection/266898/1 "2008-07-25T09:51:55Z")

</div>

I have the latest version of flash player ie 124 installed on my pc.what the problem in when i try to make a socket connection to a port of another server it gives me a security error.It works fine with older version players.

here is my code  
//function init to initialize  
private function init():void  
{  
this.soc=new XMLSocket();  
this.soc.addEventListener(DataEvent.DATA,socGetDat a);  
this.soc.addEventListener(SecurityErrorEvent.SECUR ITY\_ERROR,socSecurityError)  
this.soc.addEventListener(IOErrorEvent.IO\_ERROR,so cIOHandler);  
this.soc.addEventListener(Event.CONNECT,socConnect ed);  
this.createDisplayPanel();  
this.setSecurityDomain();

```
		}
		//end of function init
		//function setSecurityDomain for crossdomain
		private function setSecurityDomain():void
		{
		var crossDomainUrl:String="xmlsocket:www.xyz.com:8080/crossdomain.xml";
			
			Security.allowDomain("*");
			Security.loadPolicyFile(crossDomainUrl);
		}
		//end of function setSecurityDomain
		//function socConnected
		private function socConnected(e:Event):void
		{
			this.setTextMessage(e.type.toString());
			this.soc.send("hello");
		}
		//emd of function socConnected
		//function setConnection for setting connection
		private function setConnection():void
		{
			this.soc.connect(this.socUrl,this.socPort);
			this.setTextMessage("connecting");
			
		}

```

and here is my crossdomain  
\<?xml version=“1.0”?\>  
\<!DOCTYPE cross-domain-policy SYSTEM “[http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd](http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd)”\>  
\<cross-domain-policy\>  
\<allow-access-from domain="\*" to-ports=“5222” secure=“false” /\>  
\</cross-domain-policy\>

Please help with regards  
Anurag
