Alles werkend - maar echte flash clients zijn het daar niet meer eens, raar genoeg...

This commit is contained in:
Thulinma 2010-07-30 21:32:08 +02:00
parent 2d0aafc179
commit e8246efc91
8 changed files with 234 additions and 99 deletions

View file

@ -4,6 +4,8 @@ struct Handshake {
char Random[1528];
};//Handshake
char * versionstring = "PLSRTMPServer";
void doHandshake(){
srand(time(NULL));
char Version;
@ -15,10 +17,13 @@ void doHandshake(){
fread(Client.Time, 1, 4, stdin);
fread(Client.Zero, 1, 4, stdin);
fread(Client.Random, 1, 1528, stdin);
rec_cnt+=1537;
/** Build S1 Packet **/
Server.Time[0] = 0; Server.Time[1] = 0; Server.Time[2] = 0; Server.Time[3] = 0;
Server.Zero[0] = 0; Server.Zero[1] = 0; Server.Zero[2] = 0; Server.Zero[3] = 0;
for (int i = 0; i < 1528; i++){Server.Random[i] = (rand() % 256);}
for (int i = 0; i < 1528; i++){
Server.Random[i] = versionstring[i%13];
}
/** Send S0 **/
fwrite(&(Version), 1, 1, stdout);
/** Send S1 **/
@ -27,14 +32,17 @@ void doHandshake(){
fwrite(Server.Random, 1, 1528, stdout);
/** Flush output, just for certainty **/
fflush(stdout);
snd_cnt+=1537;
/** Send S2 **/
fwrite(Client.Time, 1, 4, stdout);
fwrite(Client.Time, 1, 4, stdout);
fwrite(Client.Random, 1, 1528, stdout);
snd_cnt+=1536;
/** Flush, necessary in order to work **/
fflush(stdout);
/** Read and discard C2 **/
fread(Client.Time, 1, 4, stdin);
fread(Client.Zero, 1, 4, stdin);
fread(Client.Random, 1, 1528, stdin);
}//doHandshake
rec_cnt+=1536;
}//doHandshake