Hi Geby

A friend is building a back-end service. For communication he proposed Redis because this offers a message queue.
See http://redis.io.

There I found a combination of local server + local client

and

a lazarus Redis implementation:

https://redis.io/clients#pascal

which points to

/https://github.com/ik5/redis_client.fpc
This client uses the synapse library.

Test 1)
I started the local server which works on 127.0.0.1 at port 6379.
Then I started a local client. When I enter "ping" I receive "PONG" as expected.

The log of the server shows:

[1664] 08 Dec 16:58:17 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[1664] 08 Dec 16:58:17 * Server started, Redis version 2.4.5
[1664] 08 Dec 16:58:17 * DB loaded from disk: 0 seconds
[1664] 08 Dec 16:58:17 * The server is now ready to accept connections on port 6379
[1664] 08 Dec 16:58:17 - DB 0: 3 keys (0 volatile) in 4 slots HT.

[1664] 08 Dec 16:58:17 - 0 clients connected (0 slaves), 3580296 bytes in use
[1664] 08 Dec 16:58:20 - Accepted 127.0.0.1:57343
[1664] 08 Dec 16:58:22 - DB 0: 3 keys (0 volatile) in 4 slots HT.
[1664] 08 Dec 16:58:22 - 1 clients connected (0 slaves), 3588408 bytes in use

[1664] 08 Dec 16:58:59 - DB 0: 3 keys (0 volatile) in 4 slots HT.
[1664] 08 Dec 16:58:59 - 1 clients connected (0 slaves), 3588448 bytes in use
[1664] 08 Dec 16:59:01 - Client closed connection

Noted in red: there is opened some sync(?) at port 57343.

Test 2)

With local redis server started.

I compiled a test application.

var redis : TRedisIO;
redis := TRedisIO.Create;
redis.Connect;

this points to rd_protocol.pas:

procedure TRedisIO.DoOpenConnection;
var Handled : Boolean;
begin
if not IsConnected then
begin
FSock.Bind(FIPInterface, cAnyPort);

FSock.Connect(FTargetHost, FTargetPort);
FError := ERROR_OK;
if FSock.LastError <> 0 then
begin
Handled := false;
FError := ERROR_NO_CONNECTION;
lError(txtUnableToConnect, [FTargetHost, FTargetPort]);
if Assigned(FOnError) then
FOnError(self, Handled);

if not Handled then
begin
Raise ERedisSocketException.CreateFmt(txtUnableToConnect,
[FTargetHost, FTargetPort]);
end;
end;
end;

end;

The FSock.Connect (with params '127.0.0.1' and '6379') will fail:
In blcksock.pas procedure TTCPBlockSocket.Connect(IP, Port: string) is started which switches to inherited Connect(IP,Port).

In TBlockSocket.Connect(IP, Port: string) SetSin seems to execute without errors

The sin variable values are at that point:

Sin = record TVARSIN {ADDRESSFAMILY = 2,SIN_FAMILY = 2,SIN_PORT = 60184,
SIN_ADDR = {S_BYTES = {127,0,0,1},S_ADDR = 16777343},SIN_ZERO = {0,0,0,0,0,0,0,0},SIN6_PORT = 60184,SIN6_FLOWINFO = 16777343,SIN6_ADDR = {S6_ADDR = {0 <repeats 16 times>},U6_ADDR8 = {0 <repeats 16 times>},U6_ADDR16 = {0,0,0,0,0,0,0,0},U6_ADDR32 = {0,0,0,0}},SIN6_SCOPE_ID = 0}

It seems to fail at SockCheck(synsock.Connect(FSocket, Sin));  
After that line the FLastError value is 10049 (Can''t assign requested address).

My code you can find on: http://downloads.kegge13.nl/?lijst=Nipper

I do not have any experience with coummnication protocols at all. Could you pleas shed some light?

Thanks in advance


--
Theo van Soest / no place like 127.0.0.1 / kegg...@ziggo.nl

_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to