hello,
this isn't one of those posts where I have no idea what servers are etc... this is a specific problem I'm having:
I've set up a simple java server to handle the sockets. Right now I have a simple hello! string sent to any client uppon connection. This works 100% of the time when using telnet, but when using flash I usually have to run it 2-3 times. My server is on a different domain from the flash file, but a cross-domain file is in place, and the connection does work it's just not 100%
Does anyone have any ideas on why this might be happening?
here's my as code: (very simple)
package{
import flash.events.*;
import flash.net.*;
import flash.display.MovieClip;
import flash.text.*;
public class Connection extends MovieClip{
public function Connection(){
var socket:Socket = new Socket();
socket.connect("xx.xxx.xx.xxx", 1988);
socket.addEventListener(Event.CONNECT, con);
socket.addEventListener(ProgressEvent.SOCKET_DATA, read);
}
private function read(o:ProgressEvent){
var socket:Socket = Socket(o.target);
trace("got data");
trace(socket.readUTFBytes(socket.bytesAvailable));
}
private function con(o:Event){
trace("connected");
}
}
}
help would be very apreciated this is urgent