mardi 18 avril 2017

Sending some data to server

I'm trying to send some data to my server. Unfortunately I received an error: Access of undefined property readSocketData. What should I do to make it works?

package {
import flash.net.*;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;

public class HelloWorld extends Sprite {

    public function HelloWorld() {
    }
    var s:Socket;
    private function init():void {

    s=new Socket();
    s.addEventListener(ProgressEvent.SOCKET_DATA, readSocketData);
    s.connect("127.0.0.1", 3333);
    }
    private function sendSocketData(string:String):void {
    s.writeMultiByte("someData\n", "UTF-8");
    }

    }
}

Aucun commentaire:

Enregistrer un commentaire