-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrrclient.pas
More file actions
33 lines (28 loc) · 777 Bytes
/
rrclient.pas
File metadata and controls
33 lines (28 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
Hello World client
Connects REQ socket to tcp://localhost:5559
Sends "Hello" to server, expects "World" back
@author cpicanco <cpicanco@ufpa.br>
}
program rrclient;
{$mode objfpc}{$H+}
uses SysUtils, zmq, zmq.helpers, zmq.types;
var
context, requester: Pointer;
request_nbr: Integer;
LString: string;
begin
context := zmq_ctx_new;
// Socket to talk to server
requester := zmq_socket(context, ZMQ_REQ);
zmq_connect(requester, 'tcp://localhost:5559');
for request_nbr := 0 to 9 do
begin
s_send(requester, 'Hello');
LString := s_recv(requester);
WriteLn(Format('Received reply %d [%s]', [request_nbr, LString]));
LString := '';
end;
zmq_close(requester);
zmq_ctx_destroy(context);
end.