// [FInished] : Connection Complete public async Task ConnectAsync() { try { // Step 01 : Make connection to socket on Server-Side TCP Listener if URI Schema is valid await ProtocolClient.ValidateClientRequestAsync(RtmpRequest); // Step 02 : Connect to Host Socket await ProtocolClient.ConnectAsync(RtmpRequest.Content.RtmpUri.Host, RtmpRequest.Content.RtmpUri.Port != -1?RtmpRequest.Content.RtmpUri.Port : DefaultPort); // Step 03 : Validate Socket Connection await ProtocolClient.ValidateClientConnectionAsync(RtmpRequest.ProtocolConfigurations); // Step 04 : Set the Resolved Stream RtmpStream = await ProtocolClient.ResolveStreamTypeAsync(RtmpRequest); // Step 05 : Validate Stream Properties Match with request await RtmpStream.ValidateStreamPropertiesAsync(RtmpRequest.StreamConfigurations); // Step 06 : Initialize the Handshake Sequence await RtmpStream.InitializeHandshakeSequenceAsync(StopToken); } catch (Exception exception) { throw new Exception("RMTP Connection was Unsuccessful.", exception); } }
// [FInished] : Connection Complete public async Task ConnectAsync(RtmpConnectionRequest Request) { RtmpRequest = Request; ProtocolClient.NoDelay = Request.ProtocolConfigurations.NoDelay; ProtocolClient.ExclusiveAddressUse = Request.ProtocolConfigurations.ExclusiveAddressUse; if (Request.ProtocolConfigurations.ReceiveTimeout != -1) { ProtocolClient.ReceiveTimeout = Request.ProtocolConfigurations.ReceiveTimeout; } if (Request.ProtocolConfigurations.SendTimeout != -1) { ProtocolClient.SendTimeout = Request.ProtocolConfigurations.SendTimeout; } if (Request.ProtocolConfigurations.RecieveBufferSize != -1) { ProtocolClient.ReceiveBufferSize = Request.ProtocolConfigurations.RecieveBufferSize; } if (Request.ProtocolConfigurations.SendBufferSize != -1) { try { // Step 01: Make connection to socket on Server-Side TCP Listener if URI Schema is valid await ProtocolClient.ValidateClientRequestAsync(RtmpRequest); // Step 02: Connect to Host Socket await ProtocolClient.ConnectAsync(RtmpRequest.Content.RtmpUri.Host, RtmpRequest.Content.RtmpUri.Port != -1?RtmpRequest.Content.RtmpUri.Port : DefaultPort); // Step 03: Validate Socket Connection await ProtocolClient.ValidateClientConnectionAsync(RtmpRequest.ProtocolConfigurations); // Step 04: Set the Resolved Stream RtmpStream = await ProtocolClient.ResolveStreamTypeAsync(RtmpRequest); // Step 05: Validate Stream Properties Match with request await RtmpStream.ValidateStreamPropertiesAsync(RtmpRequest.StreamConfigurations); // Step 06: Initialize the Handshake Sequence await RtmpStream.InitializeHandshakeSequenceAsync(StopToken); } catch (Exception exception) { throw new Exception("Connection was unsuccessful.", exception); } } }