home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Language specific support
Deutsches MediaPortal Forum
Hard- und Software rund um den HTPC
Hardware
TV-Karten
Digital Devices Octopus NET CT/2 Erfahrungen?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="KayDiefenthal" data-source="post: 1133939" data-attributes="member: 22825"><p>hi mm to the whitespaces if i dont use rtspclient.cs and use a socket</p><p></p><p>with this code</p><p></p><p>[code]</p><p>privatevoid Connect()</p><p></p><p>{</p><p></p><p>_rtspSocket = newSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);</p><p></p><p>var ip = IPAddress.Parse(RtspDevice.Address);</p><p></p><p>var rtspEndpoint = newIPEndPoint(ip, 554);</p><p></p><p>_rtspSocket.Connect(rtspEndpoint);</p><p></p><p>}</p><p></p><p>privatevoid Disconnect()</p><p></p><p>{</p><p></p><p>if (_rtspSocket != null && _rtspSocket.Connected)</p><p></p><p>{</p><p></p><p>_rtspSocket.Shutdown(SocketShutdown.Both);</p><p></p><p>_rtspSocket.Close();</p><p></p><p>}</p><p></p><p>}</p><p></p><p>privatevoid SendRequest(RtspRequest request)</p><p></p><p>{</p><p></p><p>if (_rtspSocket == null)</p><p></p><p>{</p><p></p><p>}</p><p></p><p>try</p><p></p><p>{</p><p></p><p>request.Headers.Add("CSeq", _rtspSequenceNum.ToString());</p><p></p><p>_rtspSequenceNum++;</p><p></p><p>byte[] requestBytes = request.Serialise();</p><p></p><p>var requestBytesCount = _rtspSocket.Send(requestBytes, requestBytes.Length, SocketFlags.None);</p><p></p><p>if (requestBytesCount < 1)</p><p></p><p>{</p><p></p><p>}</p><p></p><p>}</p><p></p><p>catch (Exception e)</p><p></p><p>{</p><p></p><p>}</p><p></p><p>}</p><p></p><p>privatevoid ReceiveResponse(outRtspResponse response)</p><p></p><p>{</p><p></p><p>response = null;</p><p></p><p>var responseBytesCount = 0;</p><p></p><p>byte[] responseBytes = newbyte[1024];</p><p></p><p>try</p><p></p><p>{</p><p></p><p>responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None);</p><p></p><p>response = RtspResponse.Deserialise(responseBytes, responseBytesCount);</p><p></p><p>string contentLengthString;</p><p></p><p>int contentLength = 0;</p><p></p><p>if (response.Headers.TryGetValue("Content-Length", out contentLengthString))</p><p></p><p>{</p><p></p><p>contentLength = int.Parse(contentLengthString);</p><p></p><p>if ((string.IsNullOrEmpty(response.Body) && contentLength > 0) || response.Body.Length < contentLength)</p><p></p><p>{</p><p></p><p>if (response.Body == null)</p><p></p><p>{</p><p></p><p>response.Body = string.Empty;</p><p></p><p>}</p><p></p><p>while (responseBytesCount > 0 && response.Body.Length < contentLength)</p><p></p><p>{</p><p></p><p>responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None);</p><p></p><p>response.Body += System.Text.Encoding.UTF8.GetString(responseBytes, 0, responseBytesCount);</p><p></p><p>}</p><p></p><p>}</p><p></p><p>}</p><p></p><p>}</p><p></p><p>catch (SocketException)</p><p></p><p>{</p><p></p><p>}</p><p></p><p>}</p><p></p><p> [/code]</p><p></p><p>have i only one whitespace and working too</p><p>but sometimes is the sessionid not found and the Triax stopp the Streaming but on this look i at time</p></blockquote><p></p>
[QUOTE="KayDiefenthal, post: 1133939, member: 22825"] hi mm to the whitespaces if i dont use rtspclient.cs and use a socket with this code [code] privatevoid Connect() { _rtspSocket = newSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); var ip = IPAddress.Parse(RtspDevice.Address); var rtspEndpoint = newIPEndPoint(ip, 554); _rtspSocket.Connect(rtspEndpoint); } privatevoid Disconnect() { if (_rtspSocket != null && _rtspSocket.Connected) { _rtspSocket.Shutdown(SocketShutdown.Both); _rtspSocket.Close(); } } privatevoid SendRequest(RtspRequest request) { if (_rtspSocket == null) { } try { request.Headers.Add("CSeq", _rtspSequenceNum.ToString()); _rtspSequenceNum++; byte[] requestBytes = request.Serialise(); var requestBytesCount = _rtspSocket.Send(requestBytes, requestBytes.Length, SocketFlags.None); if (requestBytesCount < 1) { } } catch (Exception e) { } } privatevoid ReceiveResponse(outRtspResponse response) { response = null; var responseBytesCount = 0; byte[] responseBytes = newbyte[1024]; try { responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None); response = RtspResponse.Deserialise(responseBytes, responseBytesCount); string contentLengthString; int contentLength = 0; if (response.Headers.TryGetValue("Content-Length", out contentLengthString)) { contentLength = int.Parse(contentLengthString); if ((string.IsNullOrEmpty(response.Body) && contentLength > 0) || response.Body.Length < contentLength) { if (response.Body == null) { response.Body = string.Empty; } while (responseBytesCount > 0 && response.Body.Length < contentLength) { responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None); response.Body += System.Text.Encoding.UTF8.GetString(responseBytes, 0, responseBytesCount); } } } } catch (SocketException) { } } [/code] have i only one whitespace and working too but sometimes is the sessionid not found and the Triax stopp the Streaming but on this look i at time [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Language specific support
Deutsches MediaPortal Forum
Hard- und Software rund um den HTPC
Hardware
TV-Karten
Digital Devices Octopus NET CT/2 Erfahrungen?
Contact us
RSS
Top
Bottom