After the connection, the DELPHI program IdTCPServer1Execute events get more information from web pages:, but has been unable to shake hands with success
GET/HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: localhost: 8080
Origin: null
The Sec - WebSocket - Key:/mbLym4mEC4Lbx5al1ELVg==
The Sec - WebSocket - Version: 13
=======================
Then, I in DELPHI service USES the following code to send
If (copy (scommand, 1, 2)='Sec - WebSocket - Key') then the begin////read customer information, SHA encryption etc.
SsKey:=copy (scommand, 19, length (scommand)) + 'eafa5 E914-47-258 da - 95 ca - C5AB0DC85B11';
JJSTR:=';
SHA1Init (SHA1Context);//SHA encryption
SHA1Update (SHA1Context, PChar (ssKey), Length (ssKey));
SHA1Final (SHA1Context SHA1Digest);
S2:=EncodeString (PChar (@ SHA1Digest));
JJSTR:=s2;
end;
If the copy (scommand, 1, 25)='Sec - WebSocket - Version then begin//send a handshake authentication information
Handshake:=true;
AContext. Connection. Socket. WriteLn (' HTTP/1.1 101 Switching separate Protocols');
AContext. Connection. Socket. WriteLn (' Upgrade: WebSocket);
AContext. Connection. Socket. WriteLn (' Connection: Upgrade ');
AContext. Connection. Socket. WriteLn (' the Sec - WebSocket - Accept: + JJSTR);
AContext. Connection. Socket. WriteLn (' WebSocket - Origin: http://127.0.0.1);
AContext. Connection. Socket. WriteLn (' WebSocket - Location: ws://127.0.0.1:8080 ');
end;
I met the question is, can't verification through, shaking hands as if there are no information no matter what I send HTML returned,
Unable to send information between web pages and applications, it is not solve, please eldest brother elder sister to give directions, thank!!!!!
CodePudding user response:
Waiting for the master! I would like to pay a bit fee, thank you!!!!!!!!!!!CodePudding user response:
Your client without listening to and receiving,Through BBS under somebody else's problem, a very similar, have your answer,
And friendship remind, ask this question, you'd better send the code (server and client) 2, don't let a person to guess your problem,