About Books Links Bugs History |
About
At the time of Delphi 2 and 3 there were no useable free components for Delphi,
there were only some OCX delivered, but which never worked flawless. By chance I
discovered a great book about how to program TCP/IP with Delphi,
and within a few weeks I had the first components working.
I did include most of the well-known services
- Finger (client and demon), HTTP (including post and proxy support and
basic authentication), FTP,
time, RExec, RSh, lpr,
POP3, SMTP and Mail (including MIME for file attachments), and NNTP and News.
As with the version 0.2 these components were already quite stable, I did start
with re-develope them using non-blocking Winsock calls. However this turned out to
be a can of worms, it's much more complex then the simple blocking approach, so
even though I managed to get them running again they haven't reached the
stability I aimed for to be worth a new release. Lack of time, and the now available
Indy open source components made the need for a new version less urgent. But of course
the last release is still available, together with a patch which fixed some bugs,
and also made it work for the newer Delphi version. The patch also includes the source code
of the winsock unit, which is modified to allow both static linked as well as dynamically
linked usage. However you should not use this unit only in Delphi 1 or 2, otherwise you'll
get package incompatibility problems.
TCP/IP component V0.2 (Zipped archive, 80kB)
Patches (0.22) (Zipped archive, 37kB)
Building Internet Applications with Delphi 2 by Davis Chapman et.al. Que Publishing, ISBN 0789707322 | Sadly this book is out of print, and the authors never wrote a new edition, so you have to be lucky to find a used version somewhere. Don't get confused by the Delphi 2 - everything can still be used with Delphi 6, only the chapters about the Netscape API are obsolete nowadays as IE now dominates the browsers. The book starts with a description on the fundamentals of TCP/IP, and then describes implementations for the most common protocols. The book is much more for the programmer who wants to know how these protocols work internally, not for the one who just wants to have a component for downloading files from the web. | |
Delphi/Kylix Internet Developer's Guide by Lino Tadros, Lance Bullock, Steve Teixeira Republic of Texas Pr, ISBN 1556228015 | This book is not yet published, however Steve Teixeira is well known as a author of the Delphi Developers Guide, a really good book well above the Delphi for Dummies level, so this book title sounds promising to be a valuable replacement for the previous one. |
Links
Bugs of V0.2
The following bugs are fixed with the Update,
but if you wish to you can also use the patches below.
The following line creates an error on compilation.
(*$ifndef ver100 *)
temp_socket:=Winsock.Accept(Socket,LocalAddress,x);
(*$else *) { Delphi 3 ARGH! }
temp_socket:=Winsock.Accept(Socket,@LocalAddress,@x);
(*$endif *)
Reason is Borland changed the interface of this function between Delphi 2 and
3, but the ifdef I use to switch between both is no longer valid for Delphi 4.
The quick hack: exchange the (*$ifdef ver100*) by a (*$ifdef ver120*).
It will then no longer compile with Delphi 3 however.
This may happen if you have more than one IP address on your system, e.g.
with a LAN and a dial-up Internet connection. In this case the PORT
command of the FTP protocol may send a IP address which is only valid in the LAN,
so the server can't connect to it.
Fix: In the method t_ftp.Get_datasocket exchange the line
ip:=my_ip_address;
by the following code
l:=SizeOf(LocalAddress);
if winsock.GetSockName(f_comm_socket,LocalAddress,l)<>SOCKET_ERROR then
ip:=LocalAddress.Sin_addr.S_addr
else
ip:=my_ip_address;
and add the following variable definitions in the header of this method.
var
l: longint;
LocalAddress: TSockAddr;
Add the following two lines as the first ones in T_Mail.destroy
if f_smtp<>NIL then
f_smtp.RemoveFromNotify(self);
and T_News.destroy
if f_nntp<>NIL then
f_nntp.RemoveFromNotify(self);
This problem arises if the website resides on a virtual server, that means
there are several hostnames of the same system. In this case the HTTP request
must contain the full URL instead of a relative one. To force the T_HTTP to
use the full one set the proxy property to hostname:80. For example to get
www.hoerstemeier.com set proxy
to www.hoerstemeier.com:80.
Some other servers may need the "Host:" header field, although this is
only defined with HTTP1.1, whereas my component only use HTTP1.0. However as
sending this field doesn't hurt add the following line in t_http.sendrequest
as the second line (after the SendCommand)
SendCommand('Host: '+f_hostname);
Both tricks aren't needed if you use a real proxy this isn't needed.
Work around: when removing components from a form use the order T_Mime, T_Mail/T_News, T_SMTP/T_NNTP.
Work around: comment out the dispatch(Msg) in t_tcpip.WndProc
Work around: add a #0 before the username
Work around: skip the first character of the string. Sample code:
var c:char;
TMemoryStream(RExec1.stream).Read(c,1);
if c=#0 then
TMemoryStream(RExec1.stream).seek(1,0)
else
TMemoryStream(RExec1.stream).seek(0,0);
memo1.loadFromStream(REXec1.stream);
Work around:add a TMemoryStream(RExec1.Stream).Seek(0,0)
before each call of RExec1.action.
The WM_QUERYENDSESSION isn't handled, add the following to t_tcpip.wndproc
to fix it
if msg.msg=wm_queryendsession then
msg.result:=1;
The finalization with AddExitProc doesn't work with packages.
Work around: use the ip_misc.pas from the 0.22 patch.
Date | Version | Changes |
---|---|---|
1997-05-21 | 0.1b | first published beta version, TTime, THTTP, TFTP, TSMTP, TNNTP, TPop3, TRExec, TMail, TNews, TMime, TFinger, TFingerD, Tlpr |
1997-07-02 | 0.2b | TSMTP had problems with a few SMTP server - fixed smtpdemo didn't reset recipient list after send - fixed TMail sets smtp.Sender only once - fixed ftp upload hangs after completion of send - fixed http which send #10#10 instead of #13#10 now supported Made ftp data transfers optionally non-blocking Made http post method runnable Didn't compile with D3 (winsock.accept) - fixed SMTP hang when no valid recipient is given - fixed Added a lot of OnTrace calls |
Last changed 2001-07-09