AS3 program keeps connection open though URLLoader instance is closed using close() method. Is any way to shutdown connection immediately once data is loaded?
Checking connection status from commandline using netstat command, it is showing as Eshtablished.
Please suggest.
URLLoader is a HTTP wrapper. You have to use HTTP stuff to get it done. In order to close the connection you would have to send the
Connection: close
HTTP header along with the webserver response. (Note that the default for most webservers isConnection: Keep-Alive
, and it is the behaviour you are seeing).In order to send it from Flash to the server, you would have to have the
local-trusted
orAIR application
sandbox. This is not possible when running in a browser (on the internet).From the docs:
In Flash Player and in Adobe AIR content outside of the application security sandbox, the following request headers cannot be used, and the restricted terms are not case-sensitive (for example, Get, get, and GET are all not allowed). Also, hyphenated terms apply if an underscore character is used (for example, both Content-Length and Content_Length are not allowed):
Accept-Charset, Accept-Encoding, Accept-Ranges, Age, Allow, Allowed, Authorization, Charge-To, Connect, Connection, Content-Length, Content-Location, Content-Range, Cookie, Date, Delete, ETag, Expect, Get, Head, Host, If-Modified-Since, Keep-Alive, Last-Modified, Location, Max-Forwards, Options, Origin, Post, Proxy-Authenticate, Proxy-Authorization, Proxy-Connection, Public, Put, Range, Referer, Request-Range, Retry-After, Server, TE, Trace, Trailer, Transfer-Encoding, Upgrade, URI, User-Agent, Vary, Via, Warning, WWW-Authenticate, x-flash-version.