I am beginner using Indy. I want conect to sever NNTP and read and send posts.
I see examples in
https://delphi.fandom.com/wiki/TIdNNTP but I need other examples, how to connect to server and how make secure connection (SSL or other?) ?
(12-25-2019, 02:36 PM)AndrzejB Wrote: [ -> ]I see examples in https://delphi.fandom.com/wiki/TIdNNTP but I need other examples
Why? What exactly is wrong with that example that you are not able to achieve your goal with it?
(12-25-2019, 02:36 PM)AndrzejB Wrote: [ -> ]how to connect to server and how make secure connection (SSL or other?) ?
There are tons of examples floating around of how to use SSL/TLS with Indy. Start by attaching an
SSLIOHandler component, such as
TIdSSLIOHandlerSocketOpenSSL, to the
TIdNNTP.IOHandler property, and then set the
TIdNNTP.UseTLS property to
utUseImplicitTLS or
utUseExplicitTLS depending on what kind of SSL/TLS NNTP port you are connecting to.
Is possible connect to NNTP by IPV6?
(01-03-2020, 07:26 PM)AndrzejB Wrote: [ -> ]Is possible connect to NNTP by IPV6?
Yes, simply set the
TIdNNTP.IPVersion property to
Id_IPv6 before connecting to an IPv6 server.
But I havent IPVersion, if I type "ip" is only "BoundIP". Maybe I have old version of Indy. I work with FreePascal and last I customized Delphi version of Indy to FreePascal.
Id_IPv6 have IdSocks, IdFtp, IdIcmpClient, etc.. but not NNTP.
ok
IdNNTP1.Socket.IPVersion:=Id_IPv6
but this is bad
--> I move IPVersion from protected to public
(01-04-2020, 01:18 PM)AndrzejB Wrote: [ -> ]But I havent IPVersion
Known issue.
TIdNNTP derives from
TIdTCPClientCustom rather than
TIdTCPClient. The
IPVersion property is declared as
protected in
TIdTCPClientCustom but is
published in
TIdTCPClient.
(01-04-2020, 01:18 PM)AndrzejB Wrote: [ -> ]IdNNTP1.Socket.IPVersion:=Id_IPv6
but this is bad
--> I move IPVersion from protected to public
You need to set the
TIdNNTP.IPVersion property, not the
TIdNNTP.Socket.IPVersion property, as
Connect() will overwrite the
Socket.IPVersion before creating the TCP socket.
If you are creating the
TIdNNTP object at design-time, you can use an accessor class at runtime to reach the protected
TIdNNTP.IPVersion property, eg:
Code:
type
TIdNNTPAccess = class(TIdNNTP)
end;
TIdNNTPAccess(IdNNTP1).IPVersion := Id_IPv6;
If you are creating the
TIdNNTP object yourself at runtime, you can derive from
TIdNNTP and promote the
IPVersion property, eg:
Code:
type
TMyIdNNTP = class(TIdNNTP)
public
property IPVersion;
end;
var
IdNNTP1: TMyIdNNTP;
IdNNTP1 := TMyIdNNTP.Create(Self);
IdNNTP1.IPVersion := Id_IPv6;
How to test IpV6?
I like test with localhost.
Simply create a TCP/NNTP server that is bound to a local IPv6 network adapter for listening. For instance, using TIdNNTPServer, add an entry to its Bindings collection and set that entry's IPVersion property to Id_IPv6 and IP property to '::1' (or any specific local IPv6 address of your choosing), and then set the server to Active=true to begin listening.
Then you can connect TIdNNTP to that server using Host='localhost' and IPVersion=Id_IPv6.