@@ -228,6 +228,9 @@ public void Connect(
228228 RemoteCertificateValidationCallback userCertificateSelectionCallback = null ,
229229 bool autoReconnect = false )
230230 {
231+ if ( _rtspClient != null )
232+ throw new InvalidOperationException ( "You must first call Stop() before re-connecting!" ) ;
233+
231234 _logger . LogDebug ( "Connecting to {url} " , uri ) ;
232235
233236 this . _uri = uri ;
@@ -268,13 +271,15 @@ public void Connect(
268271 {
269272 _rtspSocketStatus = RtspStatus . ConnectFailed ;
270273 _logger . LogWarning ( "Error - did not connect" ) ;
274+ Stopped ? . Invoke ( this , EventArgs . Empty ) ;
271275 return ;
272276 }
273277
274278 if ( ! _rtspSocket . Connected )
275279 {
276280 _rtspSocketStatus = RtspStatus . ConnectFailed ;
277281 _logger . LogWarning ( "Error - did not connect" ) ;
282+ Stopped ? . Invoke ( this , EventArgs . Empty ) ;
278283 return ;
279284 }
280285
@@ -335,7 +340,7 @@ public void Connect(
335340 public void TryReconnect ( )
336341 {
337342 if ( _uri == null )
338- throw new InvalidOperationException ( "Reconnect can only be called after calling Connect !" ) ;
343+ throw new InvalidOperationException ( "You must first call Connect() before re-connecting !" ) ;
339344
340345 Connect ( _uri , _rtpTransport , _credentials , _mediaRequest , _playbackSession , _userCertificateSelectionCallback , _autoReconnect ) ;
341346 }
@@ -504,6 +509,8 @@ private void StopClient()
504509 rtspClient . Stop ( ) ;
505510 _rtspClient = null ;
506511 }
512+
513+ _rtspSocket = null ; // closed by rtspClient.Stop()
507514 }
508515
509516 /// <summary>
0 commit comments