06-27-2023, 01:08 AM
Hi,
I have searched everywhere trying to find a solution to this problem.
I am a regular user of Betfair and use their polling API with idHTTP components which has worked fin for years and now I'm getting endless SSL errors, so I want to change to the Betfair Stream API using TCP.
I have a valid Login and the correct API Key which is required for Betfair API Access.
Here is my code:
I get no response at all where I should be getting
If I place the same url in a browser I do get the response, so why doesn't my code get a response?
I've been battling this for over week so any help would be appreciated.
I have searched everywhere trying to find a solution to this problem.
I am a regular user of Betfair and use their polling API with idHTTP components which has worked fin for years and now I'm getting endless SSL errors, so I want to change to the Betfair Stream API using TCP.
I have a valid Login and the correct API Key which is required for Betfair API Access.
Here is my code:
Code:
procedure TfrmStream.Button1Click(Sender: TObject);
var
SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
headers, response, connectionmessage: string;
begin
if not TCPClient.Connected then
begin
try
Memo1.Lines.Clear;
SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(TCPClient);
SSLHandler.SSLOptions.Mode := sslmClient;
SSLHandler.SSLOptions.VerifyMode := [];
SSLHandler.SSLOptions.VerifyDepth := 0 ;
SSLHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
TCPClient.IOHandler := SSLHandler;
TCPClient.Host := 'stream-api-integration.betfair.com';
TCPClient.Port := 443;
TCPClient.ConnectTimeout := 5000;
TCPClient.Connect;
response := TCPClient.IOHandler.ReadLn;
Memo1.Lines.Add(response);
except
on E: Exception do
Memo1.Lines.Add(' ====== ERROR ======' + sLineBreak +
' > ' + E.Message + sLineBreak);
end;
end
else
begin
TCPClient.Disconnect;
end;
end;
I get no response at all where I should be getting
Code:
{"op":"connection","connectionId":"105-260623224442-1720442"}
If I place the same url in a browser I do get the response, so why doesn't my code get a response?
I've been battling this for over week so any help would be appreciated.