winlin

simple handshake(specified by rtmp protocol v1.0) success

@@ -51,6 +51,7 @@ int SrsRtmp::handshake() @@ -51,6 +51,7 @@ int SrsRtmp::handshake()
51 srs_warn("read c0c1 failed. ret=%d", ret); 51 srs_warn("read c0c1 failed. ret=%d", ret);
52 return ret; 52 return ret;
53 } 53 }
  54 + srs_verbose("read c0c1 success.");
54 55
55 // plain text required. 56 // plain text required.
56 if (c0c1[0] != 0x03) { 57 if (c0c1[0] != 0x03) {
@@ -58,6 +59,26 @@ int SrsRtmp::handshake() @@ -58,6 +59,26 @@ int SrsRtmp::handshake()
58 srs_warn("only support rtmp plain text. ret=%d", ret); 59 srs_warn("only support rtmp plain text. ret=%d", ret);
59 return ret; 60 return ret;
60 } 61 }
  62 + srs_verbose("check c0 success, required plain text.");
  63 +
  64 + char* s0s1s2 = new char[3073];
  65 + SrsAutoFree(char, s0s1s2, true);
  66 + s0s1s2[0] = 0x03; // plain text.
  67 + if ((ret = skt.write(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) {
  68 + srs_warn("send s0s1s2 failed. ret=%d", ret);
  69 + return ret;
  70 + }
  71 + srs_verbose("send s0s1s2 success.");
  72 +
  73 + char* c2 = new char[1536];
  74 + SrsAutoFree(char, c2, true);
  75 + if ((ret = skt.read_fully(c2, 1536, &nsize)) != ERROR_SUCCESS) {
  76 + srs_warn("read c2 failed. ret=%d", ret);
  77 + return ret;
  78 + }
  79 + srs_verbose("read c2 success.");
  80 +
  81 + srs_trace("handshake success.");
61 82
62 return ret; 83 return ret;
63 } 84 }