Adobe Air ServerSocket not Working the same on XP/Vista/7
I'm having a strange problems with an air socket server i've written.
I have an Air application written using Flash Builder 4. It's basically a simple HTTP server. It's purpose it to open a server on a specific port and serve files (both html and swf) out to a web browser.
When i run the air application on my desktop (windows 7, firefox 4.0b11, ie8, flash builder 4 compiled with flex sck 4.1.0) everything works correctly. Whether i run the server through the Flash Builder debugger or actually do the full packaging and install as a standalone air app then run it using the Air Runtime like any user would. I load up the server, punch in the address from anywhere and the page loads, and the requested swf displays correctly. While the server is running on my desktop i've tested clients including Windows XP and Vista with IE8, HTC Evo4g Android phone, and the Playstation 3 browser. From any tested client with the server running on my desktop all requests are handled correctly and pages/swfs load and display correctly.
The problem comes when i run the air app on another computer. When i package it and install it on one of my two test systems (Windows XP and Windows Vista) things start to go wonky. The Air app loads on the two test systems but when a client tries to use their web browser to request a page things don't display correctly. The client can load the html file fine but the swf that it receives from the server does not display. I can check the log on the status server and see the HTTP GET being processed, and the file sent. However, the browser simply displays a blank box where the SWF should be. With the server running on either of my two test boxes (XP and Vista) the same clients who can connect and display html and swf's delivered from the server experience this problem.
I think i've eliminated browser request as the problem from testing different browsers on different OS's on each of the test installations. As best I can tell, the problem is with the server side of the app. The server uses the SocketServer class to listen for a connection and then writes out the HTML headers and content to the socket manually, i'm not using any external libraries for writing to the socket.
here's the code for writing to the socket when a swf is requested.
{
var content:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
stream.open(file, FileMode.READ);
stream.readBytes(content);
stream.close();
socket.writeUTFBytes("HTTP/1.1 200 OK\n");
socket.writeUTFBytes("Content-Type: application/x-shockwave-flash\r\n");
socket.writeUTFBytes("Content-Length: " + content.length + "\r\n\r\n");
socket.writeBytes(content);
}
I don't believe the problem is with the socket write since it works on my desktop but not when the server is running on another. I'm wondering if the problem is with an external system dependancy. Are there any external libraries, visual c++ runtimes, tcp/ip libraries that Air uses to fulfil requests to sockets on different operating systems/versions? I've been searching around the web and browsing through adobe live docs for a few hours on this but can't seem to find a resolution anywhere. If more detail is needed, please let me know. Any help would be much appreciated.
