public void Send(string act, string cmd, Object data) { if (!_tcpClient.Connected) throw new Exception("Closed, cannot send data."); var reqResVO = new ReqResVO(); reqResVO.accountId = SessionInfo._currentSysUserVO == null ? 0 : SessionInfo._currentSysUserVO.suAccountVO.saId; reqResVO.userId = SessionInfo._currentSysUserVO == null ? 0 : SessionInfo._currentSysUserVO.suId; reqResVO.sessionId = 0; reqResVO.action = act; reqResVO.command = cmd; reqResVO.data = data; //var id: String = getIdByVO(reqResVO); //if(callback != null) _callbackMap[id] = callback; //Logger.debug(SocketService,reqResVO.toString()); //var protocol: IProtocol = ProtocolBuilder.newProtocol(ProtocolType.AMF3_PROTOCOL); var protocol = new AMF3Protocol(); protocol.SetData(reqResVO); var b1 = protocol.GetBytes(); var b2 = FluorineFx.Util.Convert.ToByteArray(b1); var msg = new ByteArray(); msg.WriteInt(1); msg.WriteInt((int)b1.Length); var b3 = b2.Take((int)b1.Length).ToArray(); msg.WriteBytes(b3, 0, b3.Length); b3 = FluorineFx.Util.Convert.ToByteArray(msg).Take((int)msg.Length).ToArray(); Sysinfo("Sending " + act + "#" + cmd); _tcpClient.Client.Send(b3); }