[]用Socket连接服务器,服务端显示已经有登录,但Event.OPEN没有触发

package tcp
{
    import laya.events.Event;
    import laya.net.Socket;
    import laya.utils.Byte;
    
    
    public class CConnector extends Socket
    {
        protected var sendBuf:Byte = null;
        protected var recvBuf:Byte = null;
        
        public function CConnector()
        {
            this.sendBuf = this.output;
            this.recvBuf = this.input;
            
            this.on(Event.OPEN, this, OnConnected);
            this.on(Event.CLOSE, this, OnDisconnect);
            this.on(Event.MESSAGE, this, OnRecv);
            this.on(Event.ERROR, this, OnError);
        }
        
        
        public function OnConnected(e:*=null):void
        {
            trace('OnConnected');
        }
        
        public function OnDisconnect(e:*=null):void
        {
            trace('OnDisconnect');
        }
        
        public function OnRecv(data:*=null):void
        {
            trace('OnRecv');
            trace(data);
        }
        
        public function OnError(e:Event=null):void
        {
            trace('OnError');
        }


    }
}


//这样连接
            Network = new CConnector();
            Network.connect('127.0.0.1', 30000);


QQ截图20170920171441.png

 
已邀请:

chrysanthemum

赞同来自:

占用大家时间了,这个问题不用回答了,我用的C++服务器,TCP的Socket需要改造的。

cuixueying

赞同来自:

好的,有问题及时沟通!

chrysanthemum

赞同来自:

自己来擦屁股,分享一个WebSocket回声服务器,所收即所发,可调试网络部分。

无标题.png


 

要回复问题请先

商务合作
商务合作