Question

I'm just trying to implement a really really small RTSP Client with Boost Asio. It just needs to SETUP the server then dispatch a PLAY command and then later at some point request the TEARDOWN .

What troubles me is the implementation itself. For the connection itself I do it like I would want a TCP connection

tcp::resolver resolver(*io_service);
tcp::resolver::query query("192.168.0.42","554");
tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
tcp::resolver::iterator end;


tcp::socket socket(*io_service);
boost::system::error_code error = boost::asio::error::host_not_found;
while (error && endpoint_iterator != end)
{
    socket.close();
    socket.connect(*endpoint_iterator++, error);
}

Then the message itself is formulated like this:

boost::asio::streambuf request;
std::ostream request_stream(&request);
request_stream << "DESCRIBE " << "rtsp://192.168.0.42/mpeg4?multicast/ RTSP/1.0\r\nCSeq: 1\r\n";
boost::asio::write(socket, request);

Now if I send this and catch it with Wireshark, it doesn't recognize it as a RTSP Message.

So what am I doing wrong? Am I just formulating the request in my stream wrong? Or do I need to use a completely different type of connection?

Are there maybe any examples how to implement a simple RTSP client out there? I couldnt' find anything. Please don't suggest using any other libs like libcurl , i need to implement it by myself.

Was it helpful?

Solution

You need a more "\r\n" at the end of DESCRIBE message.

request_stream << "DESCRIBE " << "rtsp://192.168.0.42/mpeg4?multicast/ RTSP/1.0\r\nCSeq: 1\r\n\r\n";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top