URL
A System.String that contains the server address to be checked.
Flags
Value that indicates whether the method should negotiate the user name and password. Possible values are:
| Value | Meaning |
|---|---|
| 0 | Do not negotiate the user name and password. |
| NetSrc_CC_ForceConnection | Negotiate the user name and password. |
Timeout
Value that represents the amount of time, in milliseconds, to wait for the connection check before failing.
S_OK if the function was successful.
<>S_OK if an error occurred. Refer to the Error Codes or the HRESULT error codes in the DirectShow documentation.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureAndPlayCtrlForm _serverAndClient = new CaptureAndPlayCtrlForm();CaptureCtrl _captureCtrl;PlayCtrl _playCtrl;const string _networkUrl = @"ltsf://127.0.0.1:27015"; // network stream urlconst string _testMessage = "LEAD NETWORK";public void NetworkSourceExample(){// reference the capture control_captureCtrl = _serverAndClient.CaptureCtrl;// reference the play control_playCtrl = _serverAndClient.PlayCtrl;try{// try to find a video cameraif (_captureCtrl.VideoDevices["Logitech"] == null)throw new Exception("No Logitech video device available");_captureCtrl.VideoDevices["Logitech"].Selected = true;// select a video compressor_captureCtrl.VideoCompressors.Mpeg4.Selected = true;// set the target output file_captureCtrl.TargetFormat = TargetFormatType.NET;_captureCtrl.TargetFile = _networkUrl;if (_captureCtrl.IsModeAvailable(CaptureMode.Video)){// just 10 seconds of capture time_captureCtrl.TimeLimit = 10;_captureCtrl.UseTimeLimit = true;_captureCtrl.FrameRate = 30;_captureCtrl.UseFrameRate = true;_captureCtrl.Preview = true;// subscribe to the started and progress events for this example// we will connect a client after the capture starts_captureCtrl.Started += new EventHandler(CaptureCtrl_Started);// ready the capture graph in order to get the LNMetMux instance_captureCtrl.ReadyCapture(CaptureMode.Video);// start capture_captureCtrl.StartCapture(CaptureMode.Video);// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (_captureCtrl.State == CaptureState.Running|| _playCtrl.State == PlayState.Running){Application.DoEvents();}}}catch (Exception){_result = false;}}void CaptureCtrl_Started(object sender, EventArgs e){StartClient();}private void StartClient(){try{LMNetSrc netSrc = new LMNetSrc();netSrc.CheckConnection(_networkUrl, 0, 5000);_result = true;Marshal.ReleaseComObject(netSrc);}catch (COMException){// could not connect_result = false;return;}// connects the client player_playCtrl.SourceFile = _networkUrl;}