![]() ![]() Private function onIOError( errorEvent:IOErrorEvent ):void Should also remove from clientSockets array. Private function onClientClose( event:Event ):void Echo the received message back to the sender Var message:String = socket.readUTFBytes( tesAvailable ) Var socket:Socket = event.target as Socket Public function socketDataHandler(event:ProgressEvent):void Socket.addEventListener( IOErrorEvent.IO_ERROR, onIOError ) Socket.addEventListener( Event.CLOSE, onClientClose ) Socket.addEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler) Var socket:Socket = event.socket as Socket Thesocket is provided by the event object Public function connectHandler(event:ServerSocketConnectEvent):void Trace( "Listening on " + serverSocket.localPort ) ServerSocket.addEventListener( Event.CLOSE, onClose ) ServerSocket.addEventListener( Event.CONNECT, connectHandler ) Private var clientSockets:Array = new Array() that's basically all it does, I don't know where to go from here. ![]() This is the script I've been using, and though it does connect. I found on Adobe's site socket connections, and though I got the server to connect (I think), I have no clue how to send data to it, how to get other clients to connect to it, etc. ![]() So, I was wondering how to use TCP? I've heard it's possible, but I can't seem to find a single tutorial or any information anywhere on how to do it. There's apparently (as far as my knowledge goes) nothing you can do to make it resend data if the data was not received successfully by the recipient. I have a game in the works, and though I got the UDP to work perfectly, I sadly later found out that that is simply just a lossy protocol.
0 Comments
Leave a Reply. |