Is there any reliable mode to send data

edited March 2012 in Flash (deprecated)
I tried to send continuous data, at some point suddenly the connection was closed.
I don't know the reason about the issue. can any one help me?

Is there any reliable mode and unreliable mode to send the data?

thanks in advance....

Comments

  • Reliable data won't help when the connection is closed. Maybe you send too much data.
    Let us know more: how much do you try to send in which time and why?
  • I am trying to develop multiplayer drawing game in AIR. i tried to send 20 point per packet in continuous manner but i was disconnected from the photon server in few seconds. What would be reason?
  • What do you mean with "packet" and how often are you sending such a packet and of which data does a "point" consist?
    Furthermore how often are you calling service()?
  • The code i am trying...
    public var drawColor:uint = 0x000000;
    public var thickness:int = 5;
    private var startX:Number;
    private var startY:Number;
    private var endX:Number;
    private var endY:Number;
    
    private var pointsArr:Array;
    
    public function onCreationComplete():void
    {	
    	this.addEventListener(MouseEvent.MOUSE_DOWN, onContainerMouseDown);
    }
    
    protected function onContainerMouseDown(event:MouseEvent):void
    {
    	this.addEventListener(MouseEvent.MOUSE_MOVE, onContainerMouseMove);	
    	this.addEventListener(MouseEvent.MOUSE_UP, onContainerMouseUpOut);
    	this.addEventListener(MouseEvent.MOUSE_OUT, onContainerMouseUpOut);
    	startX = event.localX;
    	startY = event.localY;
    	
    	graphicsBoard.lineStyle(thickness, drawColor);
    	
    	pointsArr = new Array();
    	pointsArr.push({x: startX, y: startY});
    }
    

    Here i am checking with length of the array and send to photon
    protected function onContainerMouseMove(event:MouseEvent):void
    {		
    	endX = event.localX;
    	endY = event.localY;
    
    	pointsArr.push({x: startX, y: startY});
    	graphicsBoard.moveTo(startX, startY);
    	graphicsBoard.lineTo(endX, endY); 
    
    	startX = endX;
    	startY = endY;
    
    	if (pointsArr.length > MAX_POINT_SIZE) {
    		sendData();
    	}
    }
    
    protected function onContainerMouseUpOut(event:MouseEvent):void
    {
    	endX = event.localX;
    	endY = event.localY;
    	
    	this.removeEventListener(MouseEvent.MOUSE_MOVE, onContainerMouseMove);	
    	this.removeEventListener(MouseEvent.MOUSE_UP, onContainerMouseUpOut);
    	this.removeEventListener(MouseEvent.MOUSE_OUT, onContainerMouseUpOut);
    	sendData();
    	pointsArr = null;
    }
    

    This is the method to send the array of points
    private function sendData():void
    {
    	var obj:Object 	 = new Object();
    	obj.thickness 	 = this.thickness;
    	obj.color 		 = this.drawColor;
    	
    	obj.data = this.pointsArr;
    
    	var dic:Dictionary = new Dictionary();
    	dic["data"] = obj;
    	LoadBalancedPeer.getInstance().raiseCustomEventWithCode(CODE, dic);
    }
    

    This is a instance drawing app, so i am send the points instantly.
    on some point the connection get closed...
  • Hello Arun,
    i copy & pasted your code into the loadBalancing sample and it ran without any problems.
    I added the initial mouse listener within the event handler
    onConnectedToGame(event:LoadBalancingStateEvent):void
    
    because the client has be connected to the game server to raise custom events. Everything went well.
    Aside form this i also tried some data bombing to the server with high frequency (no problem) and high payload (results in correct error message).
    So i am sorry. but i cannot reproduce your error. Are you using the latest versions of SDK and Flash Player?
Sign In or Register to comment.