FAQ:
Version of FAQ: 1.1.0
The FAQ is created based on your questions. If you do not ask questions, nothing will appear here. So please ask when facing any trouble, I will reply.
Indy is very large and complex set of complicated classes. In many cases, you need simple thinks. Why use very large Indy? Use small Synapse! Synapse is very simple and maximal versatile.
In my opinion, Indy and Synapse is for different purpose. This is reason, why i develop Synapase. This is reason, why I helping to Indy.
Synapse is NOT components. It is only library units with code and classes. It cannot install, it not need install! For using synapse you can copy all neccessary Synapse units to your project directory (or to your library search path) and in your project add USES line with refference to needed Synapse units.
Non-component concept is very good for writing non-visual application, i.e. NT services, CGI programs, Command-line program. You may use synapse in visual program too. It is easy!
TCP/IP communication cannot be visualised, why use components?
See to DEMOS in distribute package. ECHO server is good sample for you!
Try next code on thread, or in any other case:
procedure TSomeThread.Execute;
var
Sock:TUDPBlockSocket;
size:integer;
buf:string;
begin
Sock:=TUDPBlockSocket.Create;
try
sock.createsocket;
sock.bind('0.0.0.0','port');
if sock.LastError<>0 then exit;
while True do
begin
if terminated then break;
if sock.canread(1000) then
begin
size:=sock.WaitingData;
if size>0 then
begin
setlength(buf,size);
sock.RecvBufferFrom(pointer(Buf),Size);
// do something with data and prepare response data
sock.SendBufferTo(pointer(Buf),length(buf));
end;
end;
sleep(1);
end;
sock.CloseSocket;
finally
sock.free;
end;
end;
You must install some Winsock wrapper with this support. Try Hummingbird or NEC.
One way is: grab from installed HummingBird SOCKS5 client this files: WSOCK32o.DLL, HUMPRDSK.DLL, WSOCK32.DLL and SOCKS.CNF. Rename ile WSOCK32.DLL to another name, i.e. HMS32.DLL. All this files copy to directory with your application. In your application use in TTCPBlockSocket or TUDPBlockSocket constructor CreateAlternate('HMS32.DLL') instead Create constructor. It's all. ;-)