private int Invoke(TypedObject packet) { lock (isInvokingLock) { int id = NextInvokeID(); pendingInvokes.Add(id); //AHANDA BURDA MEMORY LEAK //Console.Out.Write("Added pending invoke"); try { RTMPSEncoder encoder = new RTMPSEncoder(); byte[] data = encoder.EncodeInvoke(id, packet); sslStream.Write(data, 0, data.Length); return id; } catch (IOException e) { // Clear the pending invoke pendingInvokes.Remove(id); // Rethrow throw e; } } }
private int Invoke(TypedObject packet) { lock (isInvokingLock) { int id = NextInvokeID(); pendingInvokes.Add(id); try { RTMPSEncoder encoder = new RTMPSEncoder(); byte[] data = encoder.EncodeInvoke(id, packet); sslStream.Write(data, 0, data.Length); return(id); } catch (IOException e) { // Clear the pending invoke pendingInvokes.Remove(id); // Rethrow //throw e; return(0); } } }
private bool SendConnect() { Dictionary <string, object> paramaters = new Dictionary <string, object>(); paramaters.Add("app", ""); paramaters.Add("flashVer", "WIN 10,6,602,161"); paramaters.Add("swfUrl", "app:/LolClient.swf/[[DYNAMIC]]/32"); paramaters.Add("tcUrl", "rtmps://" + server + ":" + 2099); paramaters.Add("fpad", false); paramaters.Add("capabilities", 239); paramaters.Add("audioCodecs", 3575); paramaters.Add("videoCodecs", 252); paramaters.Add("videoFunction", 1); paramaters.Add("pageUrl", null); paramaters.Add("objectEncoding", 3); RTMPSEncoder encoder = new RTMPSEncoder(); byte[] connect = encoder.EncodeConnect(paramaters); sslStream.Write(connect, 0, connect.Length); while (!results.ContainsKey(1)) { Thread.Sleep(10); } TypedObject result = results[1]; results.Remove(1); if (result["result"].Equals("_error")) { Error(GetErrorMessage(result), ErrorType.Connect); Disconnect(); return(false); } DSId = result.GetTO("data").GetString("id"); isConnected = true; if (OnConnect != null) { OnConnect(this, EventArgs.Empty); } return(true); }
public byte[] EncodeConnect(Dictionary <string, object> paramaters) { List <byte> list = new List <byte>(); this.WriteStringAMF0(list, "connect"); this.WriteIntAMF0(list, 1); list.Add(17); list.Add(9); this.WriteAssociativeArray(list, paramaters); list.Add(1); list.Add(0); this.WriteStringAMF0(list, "nil"); this.WriteStringAMF0(list, ""); TypedObject typedObject = new TypedObject("flex.messaging.messages.CommandMessage"); typedObject.Add("operation", 5); typedObject.Add("correlationId", ""); typedObject.Add("timestamp", 0); typedObject.Add("messageId", RTMPSEncoder.RandomUID()); typedObject.Add("body", new TypedObject(null)); typedObject.Add("destination", ""); typedObject.Add("headers", new Dictionary <string, object> { { "DSMessagingVersion", 1.0 }, { "DSId", "my-rtmps" } }); typedObject.Add("clientId", null); typedObject.Add("timeToLive", 0); list.Add(17); this.Encode(list, typedObject); byte[] array = new byte[list.Count]; for (int i = 0; i < array.Length; i++) { array[i] = list[i]; } array = this.AddHeaders(array); array[7] = 20; return(array); }
protected TypedObject WrapBody(object body, string destination, object operation) { TypedObject headers = new TypedObject(); headers.Add("DSRequestTimeout", 60); headers.Add("DSId", DSId); headers.Add("DSEndpoint", "my-rtmps"); TypedObject ret = new TypedObject("flex.messaging.messages.RemotingMessage"); ret.Add("operation", operation); ret.Add("source", null); ret.Add("timestamp", 0); ret.Add("messageId", RTMPSEncoder.RandomUID()); ret.Add("timeToLive", 0); ret.Add("clientId", null); ret.Add("destination", destination); ret.Add("body", body); ret.Add("headers", headers); return ret; }
private bool SendConnect() { Dictionary <string, object> paramaters = new Dictionary <string, object>(); paramaters.Add("app", ""); paramaters.Add("flashVer", "WIN 10,6,602,161"); paramaters.Add("swfUrl", "app:/LolClient.swf/[[DYNAMIC]]/32"); paramaters.Add("tcUrl", string.Concat(new object[] { "rtmps://", this.server, ":", 0x833 })); paramaters.Add("fpad", false); paramaters.Add("capabilities", 0xef); paramaters.Add("audioCodecs", 0xdf7); paramaters.Add("videoCodecs", 0xfc); paramaters.Add("videoFunction", 1); paramaters.Add("pageUrl", null); paramaters.Add("objectEncoding", 3); byte[] buffer = new RTMPSEncoder().EncodeConnect(paramaters); this.sslStream.Write(buffer, 0, buffer.Length); while (!this.results.ContainsKey(1)) { Thread.Sleep(10); } TypedObject message = this.results[1]; this.results.Remove(1); if (message["result"].Equals("_error")) { this.Error(this.GetErrorMessage(message), ErrorType.Connect); this.Disconnect(); return(false); } this.DSId = message.GetTO("data").GetString("id"); this.isConnected = true; if (this.OnConnect != null) { this.OnConnect(this, EventArgs.Empty); } return(true); }
private int Invoke(TypedObject packet) { lock (isInvokingLock) { int id = NextInvokeID(); pendingInvokes.Add(id); try { RTMPSEncoder encoder = new RTMPSEncoder(); byte[] data = encoder.EncodeInvoke(id, packet); sslStream.Write(data, 0, data.Length); return id; } catch (IOException e) { // Clear the pending invoke pendingInvokes.Remove(id); // Rethrow throw e; } } }
private bool SendConnect() { Dictionary<string, object> paramaters = new Dictionary<string, object>(); paramaters.Add("app", ""); paramaters.Add("flashVer", "WIN 10,6,602,161"); paramaters.Add("swfUrl", "app:/LolClient.swf/[[DYNAMIC]]/32"); paramaters.Add("tcUrl", "rtmps://" + server + ":" + 2099); paramaters.Add("fpad", false); paramaters.Add("capabilities", 239); paramaters.Add("audioCodecs", 3575); paramaters.Add("videoCodecs", 252); paramaters.Add("videoFunction", 1); paramaters.Add("pageUrl", null); paramaters.Add("objectEncoding", 3); RTMPSEncoder encoder = new RTMPSEncoder(); byte[] connect = encoder.EncodeConnect(paramaters); sslStream.Write(connect, 0, connect.Length); while (!results.ContainsKey(1)) Thread.Sleep(10); TypedObject result = results[1]; results.Remove(1); if (result["result"].Equals("_error")) { Error(GetErrorMessage(result), ErrorType.Connect); Disconnect(); return false; } DSId = result.GetTO("data").GetString("id"); isConnected = true; if (OnConnect != null) OnConnect(this, EventArgs.Empty); return true; }