Synapse
Synchronous TCP/IP Library for Delphi,
C++ Builder, Kylix and FreePascal

FAQ:

Version of FAQ: 1.8.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.


Why Synapse instead Indy?

   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.

   And IMHO Synapse is much better with nearly 100% kompatibility between Windows and Linux platform. Indy have lot of problems in Linux platform!


How can I install Synapse components?

   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?


How can I write TCP server?

   See to DEMOS in distribute package. ECHO server is good sample for you!


I try ECHO demo under Kylix, byt they not work. Why?

   Because this demo uses standard port 8 fpr echo. but Linux systems ussualy have their echo server at this port. Suimply change source of Demo for use another port instead 'echo'. (i.e. 2000).


How can I write UDP server?

    Look to articles!


How can I use SOCKS5 proxy?

    Under windows you may install some Winsock wrapper with this support. Try Hummingbird or NEC.

    But latest releases of Synapse have full native support for SOCKS5 in library code. Simply you fill adequate properties and this is all! Not need any external libraries, etc.


Do Synapse all exactly same under Windows and Linux?

    Yes! Only one small exception is loading alternate socket stack. Only under windows you may select what DLL is used for calling Winsock. Under linux is called Libc in all cases. All other thinks is same under both operating systems, include autodetection time zones or autodetection of charset used by system.


Why I get negative numbers instead large integer numbers in some cases?

    Because lot of internet protocols use unsigned 32-bit integers type. But Delphi Integer type is signed! 31-bits used for value, last bit is sign. If I load 32-bit unsigned integer to Delphi Integer type, last 32-th bit is loades to sign. This is reason why large internet integer looks like negative numbers.

    Nevertheless this negative number is same value as 32-bit internet integer! Different is only representation of this number. If you try convert this negative number to HEX, (or other format), you get correct value. If you try typecast this negative value to larger integer type (i.e. int64), you get good value!

    Negative values is not bug, it is only different representation of same value of large number!


Why you not use Int64 type for large integers?

    Because older Delphi does not have this 64-bit integer type! But Synapse is compatible with Delphi version 2.0 and 3.0 too! Cardinal type is not solution, because in this older Delphi versions is cardinal only 31-bits integer. (It is terrible!)


Where can I find any demos and examples?

    Check documentation and demo subdirectory in distribute packages. You may also check contributed download area.


Where can I find SNMP TRAP demo?

    If you not found demo in DEMO subdirectory in synapse.zip, try to search contributed download. You can find interesting stuff under articles too.


Where can I find contributed download area?

    Look to main page of Synapse's WEB. Between download links you can find ling to directory with contributed downloads.


Can I use Synapse as free?

    Check BSD style license... generally: Yes, you may use Synapse in all your projects, you must only respects my copyrights. For details check license file.


Can I use SSL with Synapse?

    Yes. You need OpenSSL library at least version 0.9.6c. Interface between OpenSSL and Synapse is created in unit SynaSSL.pas. OpenSSL is loaded to memory only on demand. If you not need SSL/TLS mode, then you not need OpenSSL!
For simply use of SSL mode is prepared lot of methods in TCP code.

    HTTP protocol implementation is SSL ready... simply use 'https' in URL.

    IMAP, SMTP or POP3 protocols now support SSL too.


How can I bind UDP listener to more then one IP? (Indy can do it.)

    Is impossible bind one socket to more then one IP. Indy virtually can do it, but this is only illusions. Indy create one socket for each binded interface! If you need this, simply create one socket for each IP by your hands.


How can determine, if TCP connection is still active?

    Direct test is impossible. Determining if connection still alive you can do only at moment of communicating. If you try send or receive data on broken TCP channel, then error is returned. It is only one way to determine broken TCP channel!

    If Connection is closed gracefuly, then CanRead is signalised, but read operation read 0 bytes.

    Yes, other packages have property 'active', but true value of this property is determined previous principes. It is not direct determine of live TCP conection. It is faked value!


Where is event for reading data?

    There is no any event for reading data. Synapse have another reading design!

    Other asynchronous packages have event, what is called if some data arraived. You must implement this event, read all data to your buffers, and then your application logic must parse this data.

    In Synapse is another logic used. There is no any event! All data is readed at moment when your application logic need data. Simply you implement your application logic in style: "I need send data, simply call command for send. I need receive some data, simply call command for receive this data."


How to use Synapse .pas files in Borland C++Builder's projects?

    Look to articles!


How to use UDP multicasts?

    Look to articles!


Synapse using SyncObjs.pas, but I not have them!

   In some versions of Delphi is this unit missing. (In D4 standard) I don't know why! older or newer versions have this unit.

   However you can download this unit from "contributed download area".


I cannot set one stopbit in SynaSer. Why?

   Because you not reading documentation! (and comments inside source code too). Values for stopbits are:
0... mean 1 stopbit (!)
1... mean 1.5 stopbit (!)
2... mean 2 stopbits