sending rtsp packets to server

This is the place for queries that don't fit in any of the other categories.

sending rtsp packets to server

Postby pythonuser1 » Mon Sep 23, 2013 11:04 pm

am working on implement a streaming video server and client that communicate using
the Real-Time Streaming Protocol (RTSP) and send data using the Real-time Transfer Protocol (RTP).
My task is to implement the RTSP protocol in the client and implement the RTP packetization in the
server.
I am provided with code that implements the RTSP protocol in the server, the RTP de-packetization
in the client, and takes care of displaying the transmitted video.
I wanted help with writing the rtsp request to the server. this is the client function for sending and receiving rtsp request
Code: Select all
   def sendRtspRequest(self, requestCode):
      """Send RTSP request to the server."""   
      #-------------
      # TO COMPLETE
      #-------------
      
      # Setup request
      if requestCode == self.SETUP and self.state == self.INIT:
         threading.Thread(target=self.recvRtspReply).start()
         # Update RTSP sequence number.
         # ...
         
         # Write the RTSP request to be sent.
         # request = ...
         
         # Keep track of the sent request.
         # self.requestSent = ...
      
      # Play request
      elif requestCode == self.PLAY and self.state == self.READY:
         # Update RTSP sequence number.
         # ...
         
         # Write the RTSP request to be sent.
         # request = ...
         
         # Keep track of the sent request.
         # self.requestSent = ...
      
      # Pause request
      elif requestCode == self.PAUSE and self.state == self.PLAYING:
         # Update RTSP sequence number.
         # ...
         
         # Write the RTSP request to be sent.
         # request = ...
         
         # Keep track of the sent request.
         # self.requestSent = ...
         
      # Teardown request
      elif requestCode == self.TEARDOWN and not self.state == self.INIT:
         # Update RTSP sequence number.
         # ...
         
         # Write the RTSP request to be sent.
         # request = ...
         
         # Keep track of the sent request.
         # self.requestSent = ...
      else:
         return
      
      # Send the RTSP request using rtspSocket.
      # ...
      
      print '\nData sent:\n' + request
   
   def recvRtspReply(self):
      """Receive RTSP reply from the server."""
      while True:
         reply = self.rtspSocket.recv(1024)
         
         if reply:
            self.parseRtspReply(reply)
         
         # Close the RTSP socket upon requesting Teardown
         if self.requestSent == self.TEARDOWN:
            self.rtspSocket.shutdown(socket.SHUT_RDWR)
            self.rtspSocket.close()
            break
Last edited by micseydel on Mon Sep 23, 2013 11:15 pm, edited 1 time in total.
Reason: First post lock, code tags added.
pythonuser1
 
Posts: 1
Joined: Mon Sep 23, 2013 10:52 pm

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 3 guests