Ultibo port of Synapse socket library now on GitHub

Releases, updates and announcements from the Ultibo team.
User avatar
Ultibo
Site Admin
Posts: 1978
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Ultibo port of Synapse socket library now on GitHub

Postby Ultibo » Fri Sep 29, 2017 8:25 am

A working port of the Synapse socket library is now available on GitHub at https://github.com/ultibohub/AraratSynapse

At this point all features of the official Synapse library are working except for SSL/TLS support which requires the appropriate cryptography to be added to Ultibo core.

The Ultibo port also provides support for Synapse serial port classes and includes 10 examples ranging from an FTP server, network Ping scan, HTTP proxy and email sending demo.

What is Synapse?

Synapse (also known as Ararat Synapse) is a set of object pascal classes for Delphi and Free Pascal to support blocking (synchronous) network sockets on both Windows and Linux hosts. The library includes classes for a wide range of network protocols including DNS, FTP, TFTP, HTTP, IMAP, LDAP, NNTP, PING, POP3, SysLog, SMTP, SNMP and SNTP as well as generic classes that can be used to build other protocols.

You can find more information about Ararat Synapse from the website at http://synapse.ararat.cz/

Extensive documentation of all of the available classes and functions is also available from http://synapse.ararat.cz/doc/help/

How do I install Synapse for use with Ultibo?

Installation of the Synapse socket library is very simple, download the latest release of the Ultibo version from GitHub at https://github.com/ultibohub/AraratSynapse/releases and unzip the contents to a folder somewhere on your computer.

There are a number of examples included in the download under \source\demo and you can open any one of these directly from the Ultibo version of Lazarus and compile it by selecting Run, Build from the menu. The examples are all created for a Raspberry Pi 2 and will run without change on a Raspberry Pi 3, to convert them to an A/B/A+/B+ or Zero simply create a new project, copy the contents of the example and adjust the appropriate units.

In order to create your own projects using Synapse simply add the full path of the \source\lib folder to the "Other unit files" path under Project options in Lazarus.

What is the future of the Ultibo port of Synapse?

After some initial experimentation with Synapse during 2016 it was found to be relatively easy to port to Ultibo due to the complete Winsock2 support included and high degree of compatibility with the core functionality of Ultibo. We see Synapse as one of several popular open source projects that is well suited to using with Ultibo and so we were keen to provide this as an option for anyone wanting to migrate existing projects from Windows or Linux to Ultibo without needing to extensively rewrite their code and therefore will continue to maintain this port with future updates.

How will the Ultibo port of Synapse be supported?

If you have questions specific to the Ultibo port then please post them in the the Ultibo forum, if your question relates more specifically to Synapse itself then see the official website for more information on how to obtain answers to your questions, alternatively there are a number of Synapse users on the Lazarus forum who may also be able to help.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1387
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo port of Synapse socket library now on GitHub

Postby Gavinmc42 » Fri Sep 29, 2017 9:10 am

Does that mean my Iot Pi's can now email me?
mark
Posts: 1185
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: Ultibo port of Synapse socket library now on GitHub

Postby mark » Fri Sep 29, 2017 8:38 pm

https://github.com/ultibohub/Examples

I'm having touble finding the instructions for updating the examples menu in Ultibo Lazarus. Thanks, Mark.
User avatar
Ultibo
Site Admin
Posts: 1978
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Ultibo port of Synapse socket library now on GitHub

Postby Ultibo » Sat Sep 30, 2017 1:27 am

Gavinmc42 wrote:Does that mean my Iot Pi's can now email me?

Yes of course, see the examples for more information.
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Ultibo
Site Admin
Posts: 1978
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Ultibo port of Synapse socket library now on GitHub

Postby Ultibo » Sat Sep 30, 2017 1:34 am

mark wrote:I'm having touble finding the instructions for updating the examples menu in Ultibo Lazarus.

The Synapse examples are not intended to appear under Tools, Example projects... in Lazarus.

Downloading the latest release from https://github.com/ultibohub/AraratSynapse/releases includes the examples and the documentation which you just unzip to a folder of your choice.

The examples are only in the Ultibo examples repository because they are not available anywhere in the Synapse sources on Sourceforge. In order for us to fork the original version and continue to takes updates we needed to maintain the same structure.

We have just updated the README to reflect this more clearly.

FYI: The Lazarus examples dialog simply looks for a README.txt file in each folder, nothing more complicated than that.
Ultibo.org | Make something amazing
https://ultibo.org
MiniQ9
Posts: 11
Joined: Fri Jul 15, 2016 12:55 pm

Re: Ultibo port of Synapse socket library now on GitHub

Postby MiniQ9 » Sat Sep 30, 2017 8:51 pm

I have problems with the work of the UDP-protocol on Ultibo.
This code not worked.

Code: Select all

procedure multicasttest;
var
  sndsock:TUDPBlockSocket;
  rcvsock:TUDPBlockSocket;
  buf:string;
begin
  sndsock:=TUDPBlockSocket.Create;
  rcvsock:=TUDPBlockSocket.Create;
  try
    rcvsock.createsocket;
    rcvsock.Bind('0.0.0.0','22401');
    rcvsock.AddMulticast('234.5.6.7');
    Assert(rcvsock.LastError = 0);
 
    sndsock.createsocket;
    sndsock.Bind('0.0.0.0','0');
    sndsock.MulticastTTL := 1;
    sndsock.connect('234.5.6.7','22401');
    Assert(sndsock.LastError = 0);
 
    sndsock.SendString('Test Payload');
    buf:=rcvsock.RecvPacket(1000);
    showmessage(buf);
 
    sndsock.CloseSocket;
    rcvsock.CloseSocket;
  finally
    sndsock.free;
    rcvsock.free;
  end;
end;

http://www.ararat.cz/synapse/doku.php/public:howto:udpmulticast
User avatar
Ultibo
Site Admin
Posts: 1978
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Ultibo port of Synapse socket library now on GitHub

Postby Ultibo » Mon Oct 02, 2017 12:05 am

MiniQ9 wrote:I have problems with the work of the UDP-protocol on Ultibo.
This code not worked.

Confirmed, there are some missing elements to connect the IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP options to the actual network adapter and add/remove multicast addresses.

Leave it with us and we'll see if those missing items can be added.
Ultibo.org | Make something amazing
https://ultibo.org
develone
Posts: 272
Joined: Wed Dec 28, 2016 7:40 pm
Location: El Paso Tx USA

Re: Ultibo port of Synapse socket library now on GitHub

Postby develone » Wed Oct 11, 2017 6:32 pm

made a few chgs trying to get SendMail to work.
mailsend.pas
DnsServers.CommaText:='dns156r9.sbcglobal.net,dns157r9.sbcglobal.net';
I do the following

nslookup yahoo.com dns156r9.sbcglobal.net
Server: dns156r9.sbcglobal.net
Address: 68.94.156.9#53

Non-authoritative answer:
Name: yahoo.com
Address: 98.138.253.109
Name: yahoo.com
Address: 98.139.180.149
Name: yahoo.com
Address: 206.190.36.45
Attachments
20171011_122543.jpg
20171011_122543.jpg (400.49 KiB) Viewed 714 times
User avatar
Ultibo
Site Admin
Posts: 1978
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Ultibo port of Synapse socket library now on GitHub

Postby Ultibo » Wed Oct 11, 2017 10:24 pm

develone wrote:DnsServers.CommaText:='dns156r9.sbcglobal.net,dns157r9.sbcglobal.net';

You cannot supply names for the DNS servers, because DNS is needed to resolve the names to IP addresses so if the DNS servers are supplied as names then there is no way to look them up!

If you wanted to use these two servers you would have to do this:

Code: Select all

 DnsServers.CommaText:='68.94.156.9,68.94.157.9';

But most likely that is not needed, your local network will probably already have a DNS server available (possibly built into your local modem/router) and that should be able to resolve yahoo.com for you.

Also note that many ISPs do not allow customers to directly send email to servers on the internet, instead they require you to use their relay servers. In that case the example needs to be modified to set the EmailHost variable to the name or address of that server which you should obtain from your ISP.
Ultibo.org | Make something amazing
https://ultibo.org

Return to “Ultibo”

Who is online

Users browsing this forum: No registered users and 1 guest