Ejemplo n.º 1
0
    def handshake(self):
        """ Perform the handshake sequence with the server. """

        # superDebugNotice("rtmp client handshake")

        self.stream.write_uchar(3)
        c1 = rtmp_protocol_base.Packet()
        c1.first = 0
        c1.second = 0
        c1.payload = 'x'*1528
        c1.encode(self.stream)
        self.stream.flush()

        # superDebug("c1 first", c1.first)
        # superDebug("c1 second", c1.second)
        # superDebug("c1 payload", c1.payload)

        self.stream.read_uchar()
        s1 = rtmp_protocol_base.Packet()
        s1.decode(self.stream)

        c2 = rtmp_protocol_base.Packet()
        c2.first = s1.first
        c2.second = s1.second
        c2.payload = s1.payload
        c2.encode(self.stream)
        self.stream.flush()

        # superDebug("c2 first", c2.first)
        # superDebug("c2 second", c2.second)
        # superDebug("c2 payload", c2.payload)

        s2 = rtmp_protocol_base.Packet()
        s2.decode(self.stream)
Ejemplo n.º 2
0
    def handle_C1(self):
        """
        Handle version byte and first handshake packet sent by client. Send
        version byte and two handshake packets to client.
        """
        self.sock_stream.read_uchar()
        c1 = rtmp_protocol_base.Packet()
        c1.decode(self.sock_stream)

        self.sock_stream.write_uchar(3)
        s1 = rtmp_protocol_base.Packet(first=0, second=0, payload='x' * 1528)
        s1.encode(self.sock_stream)
        s2 = rtmp_protocol_base.Packet(first=0, second=0, payload='x' * 1528)
        s2.encode(self.sock_stream)
        self.sock_stream.flush()
Ejemplo n.º 3
0
    def handshake(self):
        """ Perform the handshake sequence with the server. """
        self.stream.write_uchar(3)
        c1 = rtmp_protocol_base.Packet()
        c1.first = 0
        c1.second = 0
        c1.payload = 'x' * 1528
        c1.encode(self.stream)
        self.stream.flush()

        self.stream.read_uchar()
        s1 = rtmp_protocol_base.Packet()
        s1.decode(self.stream)

        c2 = rtmp_protocol_base.Packet()
        c2.first = s1.first
        c2.second = s1.second
        c2.payload = s1.payload
        c2.encode(self.stream)
        self.stream.flush()

        s2 = rtmp_protocol_base.Packet()
        s2.decode(self.stream)
Ejemplo n.º 4
0
 def handle_C2(self):
     """ Handle second handshake packet from client. """
     c2 = rtmp_protocol_base.Packet()
     c2.decode(self.sock_stream)