GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::HL7::Daemon(3) User Contributed Perl Documentation Net::HL7::Daemon(3)

Net::HL7::Daemon

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

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

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

Net::HL7::Daemon::Client

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

getRequest()
Get the current request on this client. The current request is either the request that has been read by the getNextRequest() method, or if that hasn't been called yet, the request read from the socket. The latter is implemented by calling getNextRequest. If both fail, "undef" is returned. In case of failure, then the Net::HL7::Daemon::Client object ($c) should be discarded, and you should not call this method again.

Potentially, a HL7 client can receive more than one message. So discard the client only when there's no more requests pending, or the delivering service might experience timeouts.

getNextRequest()
Read data from the socket and turn it into an Net::HL7::Request object which is then returned. It returns "undef" if reading of the request fails. If it fails, then the Net::HL7::Daemon::Client object ($c) should be discarded, and you should not call this method again. Potentially, a HL7 client can receive more than one message. So discard the client only when there's no more requests pending, or the delivering service might experience timeouts.
sendAck([$res])
Write a Net::HL7::Messages::ACK message to the client as a response, to signal success. You may provide your own Net::HL7::Response, but it is better to rely on the ACK that is generated internally.
sendNack([$errMsg], [$res])
Write a Net::HL7::Messages::ACK message to the client as a response, with the Acknowledge Code (MSA(1)) set to CE or AE, depending on the original request, to signal an error.
sendResponse($res)
Write a Net::HL7::Reponse object to the client as a response. This can hold an arbitrary HL7 message.

RFC 2068

IO::Socket::INET

Copyright 2003, D.A.Dokter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Hey! The above document had some coding errors, which are explained below:
Around line 288:
=pod directives shouldn't be over one line long! Ignoring all 2 lines of content
2004-02-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.