I'm really sorry to have to ask this, but I clearly don't understand something fundamental to Delphi.
When you declare a variable of a class like TIdSSLIOHandlerSocketOpenSSL, what do you have to initiate it to? Clearly if it was a string or an integer then the requisite value would be a string on an integer, but in this case it is less obvious(to people as incapable as me). Not initiating it results in an access violation, and I understand why having found an article on it here at about.com, but that article doesn't explain what to initiate to.
Below is the code that gives the access violation because I haven't initiated the variable client (it's an application without a gui)
program New;
uses
Windows, Messages, SysUtils, Variants, Classes,
Sockets, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack,
IdServerIOHandler, IdSSL, IdSSLOpenSSL;
function Handshake(target: string; port: integer) : string;
var client: TIdSSLIOHandlerSocketOpenSSL;
begin
client.Create();
client.Port := port;
client.Destination := target;
client.Destroy;
end;
begin
Handshake('127.0.0.1',15);
end.
Apologies for my ignorance,
N