1Net::HL7::Daemon(3)   User Contributed Perl Documentation  Net::HL7::Daemon(3)
2
3
4

NAME

6       Net::HL7::Daemon
7

SYNOPSIS

9       my $d = new Net::HL7::Daemon( LocalPort => 12002, Listen => 5 );
10

DESCRIPTION

12       The Net::HL7::Daemon class provides a Daemon, roughly based on the well
13       known HTTP::Daemon class. The daemon wraps IO::Socket::INET so that
14       incoming connections are returned as Net::HL7::Daemon::Client objects.
15       Other than that the Daemon class doesn't do all that much. However,
16       this allows you to use the Daemon class as a base for more elaborate
17       servers, like preforking or multi-threaded servers. See the Perl
18       Cookbook for examples on this, and think Net::HL7::Daemon where you see
19       IO::Socket.
20

METHODS

22       $d = new Net::HL7::Daemon()
23           Create a new instance of the Daemon class. Arguments are the same
24           as for the IO::Socket::INET. Default settings are: Listen =
25           SOMAXCONN, Proto = tcp, Reuse = 1.
26
27       accept([$pkg])
28           This method is the same as IO::Socket::accept but returns an
29           Net::HL7::Daemon::Client reference.  It returns undef if you
30           specify a timeout and no connection is made within that time.  In a
31           scalar context the returned value will be a reference to a object
32           of the Net::HL7::Daemon::Client class which is another
33           IO::Socket::INET subclass.  In a list context a two-element array
34           is returned containing the new Net::HL7::Daemon::Client reference
35           and the peer address; the list will be empty upon failure.
36
37       getHost()
38           Returns the host where this daemon can be reached.
39
40       getPort()
41           Returns the port on which this daemon is listening.
42

NAME

44       Net::HL7::Daemon::Client
45

DESCRIPTION

47       The Net::HL7::Daemon::Client is also a IO::Socket::INET subclass.
48       Instances of this class are returned by the accept() method of
49       Net::HL7::Daemon.
50

METHODS

52       $d = new Net::HL7::Daemon::Client()
53           Create a new instance of the Client class. Arguments are the same
54           as for the IO::Socket::INET. Normally, you shouldn't do this...
55
56       getRequest()
57           Get the current request on this client. The current request is
58           either the request that has been read by the getNextRequest()
59           method, or if that hasn't been called yet, the request read from
60           the socket. The latter is implemented by calling getNextRequest. If
61           both fail, "undef" is returned.  In case of failure, then the
62           Net::HL7::Daemon::Client object ($c) should be discarded, and you
63           should not call this method again.
64
65           Potentially, a HL7 client can receive more than one message. So
66           discard the client only when there's no more requests pending, or
67           the delivering service might experience timeouts.
68
69       getNextRequest()
70           Read data from the socket and turn it into an Net::HL7::Request
71           object which is then returned.  It returns "undef" if reading of
72           the request fails.  If it fails, then the Net::HL7::Daemon::Client
73           object ($c) should be discarded, and you should not call this
74           method again.  Potentially, a HL7 client can receive more than one
75           message. So discard the client only when there's no more requests
76           pending, or the delivering service might experience timeouts.
77
78       sendAck($res)
79           Write a Net::HL7::Messages::ACK message to the client as a
80           response, to signal success. You may provide your own
81           Net::HL7::Response, but it is better to rely on the ACK that is
82           generated internally.
83
84       sendNack($errMsg, $res)
85           Write a Net::HL7::Messages::ACK message to the client as a
86           response, with the Acknowledge Code (MSA(1)) set to CE or AE,
87           depending on the original request, to signal an error.
88
89       sendResponse($res)
90           Write a Net::HL7::Reponse object to the client as a response. This
91           can hold an arbitrary HL7 message.
92

SEE ALSO

94       RFC 2068
95
96       IO::Socket::INET
97
99       Copyright 2003, D.A.Dokter
100
101       This library is free software; you can redistribute it and/or modify it
102       under the same terms as Perl itself.
103
104
105
106perl v5.30.0                      2019-07-26               Net::HL7::Daemon(3)
Impressum