Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Flash / Actionscript How to set socket timout()

Avatar of cubicalmonkey
cubicalmonkey asked on
Adobe FlashApache Flex
2 Comments1 Solution1745 ViewsLast Modified:
I'm sure this is an easy question but I just cant seem to make it with with my junior AS3 skills.
Trying to figure out how to set the timeout on a binary socket connection.
Basically what I'm looking to do is attempt to reconnect to my socket if the first connection fails.
From what I've read and experience,  the default socket time out is 20 seconds which is much too long for me.
Id like to set this to say, 5 seconds.
Hoping this resolves some of the  flash "error #2048" problems I'm seeing.
Thanks for your help!

function startTest():void{
	Tbytes = 0;
	ExternalInterface.call( "updateStatus","Preparing download test");

function connectToSocket():void{
	s = new Socket(host, 7890);
	s.addEventListener(IOErrorEvent.IO_ERROR, showError);
	s.addEventListener(Event.CLOSE, closeHandler);
	s.addEventListener(Event.CONNECT, connectHandler);
	s.addEventListener(ProgressEvent.SOCKET_DATA, handleTcpData);

var connCounter	:Number = 0;

function securityError(event:Event):void {
	if(connCounter < 4){
		ExternalInterface.call("logError","securityError:-Counter:"+connCounter + feedback,stripspaces(event.toString()));
	connCounter ++;
Avatar of vindys80
vindys80Flag of India image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers