lib/rtsp/client.rb
def send_message message
      RTSP::Client.log "Sending #{message.method_type.upcase} to #{message.request_uri}"
      message.to_s.each_line { |line| RTSP::Client.log line.strip }

      begin
        response = Timeout::timeout(@connection.timeout) do
          @connection.socket.send(message.to_s, 0)
          socket_data = @connection.socket.recvfrom MAX_BYTES_TO_RECEIVE

          RTSP::Client.log "Received response:"
          socket_data.first.each_line { |line| RTSP::Client.log line.strip }

          RTSP::Response.new socket_data.first
        end
      rescue Timeout::Error
        raise RTSP::Error, "Request took more than #{@connection.timeout} seconds to send."
      end

      response
    end
# Sends the message over the socket.
#
# @param [RTSP::Message] message
# @return [RTSP::Response]
# @raise [RTSP::Error] If the timeout value is reached and the server hasn't
#   responded.
Sends the message over the socket.
Sends the message over the socket .
def send_message message
      RTSP::Client.log "Sending #{message.method_type.upcase} to #{message.request_uri}"
      message.to_s.each_line { |line| RTSP::Client.log line.strip }
      begin
        response = Timeout::timeout(@connection.timeout) do
          @connection.socket.send(message.to_s, 0)
          socket_data = @connection.socket.recvfrom MAX_BYTES_TO_RECEIVE
          RTSP::Client.log "Received response:"
          socket_data.first.each_line { |line| RTSP::Client.log line.strip }
          RTSP::Response.new socket_data.first
        end
      rescue Timeout::Error
        raise RTSP::Error, "Request took more than #{@connection.timeout} seconds to send."
      end
      response
    end
def send_message message RTSP :: Client . log "Sending #{message.method_type.upcase} to #{message.request_uri}" message . to_s . each_line { | line | RTSP :: Client . log line . strip } begin response = Timeout :: timeout ( @connection . timeout ) do @connection . socket . send ( message . to_s , 0 ) socket_data = @connection . socket . recvfrom MAX_BYTES_TO_RECEIVE RTSP :: Client . log "Received response:" socket_data . first . each_line { | line | RTSP :: Client . log line . strip } RTSP :: Response . new socket_data . first end rescue Timeout :: Error raise RTSP :: Error , "Request took more than #{@connection.timeout} seconds to send." end response end
Sends the message over the socket.
Sends the message over the socket .
None
RTSP::Response
[RTSP::Error] If the timeout value is reached and the server hasn't responded.
[ RTSP :: Error ] If the timeout value is reached and the server hasn ' t responded .
message
None