def sendRtspRequest(self, requestCode):
    'Send RTSP request to the server.'
    if ((requestCode == self.SETUP) and (self.state == self.INIT)):
        threading.Thread(target=self.recvRtspReply).start()
        self.rtspSeq += 1
        request = ((((('SETUP ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nTransport: RTP/UDP; client_port= ') + str(self.rtpPort))
        self.requestSent = self.SETUP
    elif ((requestCode == self.PLAY) and (self.state == self.READY)):
        self.rtspSeq += 1
        request = ((((('PLAY ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.PLAY
    elif ((requestCode == self.PAUSE) and (self.state == self.PLAYING)):
        self.rtspSeq += 1
        request = ((((('PAUSE ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.PAUSE
    elif ((requestCode == self.TEARDOWN) and (not (self.state == self.INIT))):
        self.rtspSeq += 1
        request = ((((('TEARDOWN ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.TEARDOWN
    elif ((requestCode == self.FASTER) and ((self.state == self.PLAYING) or (self.state == self.READY))):
        self.rtspSeq += 1
        request = ((((('FASTER ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
    elif ((requestCode == self.SLOWER) and ((self.state == self.PLAYING) or (self.state == self.READY))):
        self.rtspSeq += 1
        request = ((((('SLOWER ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
    else:
        return
    self.rtspSocket.send(request.encode())
    print(('\nData sent:\n' + request))
Send RTSP request to the server.
def sendRtspRequest(self, requestCode):
    
    if ((requestCode == self.SETUP) and (self.state == self.INIT)):
        threading.Thread(target=self.recvRtspReply).start()
        self.rtspSeq += 1
        request = ((((('SETUP ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nTransport: RTP/UDP; client_port= ') + str(self.rtpPort))
        self.requestSent = self.SETUP
    elif ((requestCode == self.PLAY) and (self.state == self.READY)):
        self.rtspSeq += 1
        request = ((((('PLAY ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.PLAY
    elif ((requestCode == self.PAUSE) and (self.state == self.PLAYING)):
        self.rtspSeq += 1
        request = ((((('PAUSE ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.PAUSE
    elif ((requestCode == self.TEARDOWN) and (not (self.state == self.INIT))):
        self.rtspSeq += 1
        request = ((((('TEARDOWN ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
        self.requestSent = self.TEARDOWN
    elif ((requestCode == self.FASTER) and ((self.state == self.PLAYING) or (self.state == self.READY))):
        self.rtspSeq += 1
        request = ((((('FASTER ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
    elif ((requestCode == self.SLOWER) and ((self.state == self.PLAYING) or (self.state == self.READY))):
        self.rtspSeq += 1
        request = ((((('SLOWER ' + self.fileName) + ' RTSP/1.0\nCSeq: ') + str(self.rtspSeq)) + '\nSession: ') + str(self.sessionId))
    else:
        return
    self.rtspSocket.send(request.encode())
    print(('\nData sent:\n' + request))