MLLPServer Class
Properties Methods Events Configuration Settings Errors
The MLLPServer component implements the server side of the Minimal Lower Layer Protocol.
Class Name
InEDI_MLLPServer
Procedural Interface
inedi_mllpserver_open(); inedi_mllpserver_close($res); inedi_mllpserver_register_callback($res, $id, $function); inedi_mllpserver_get_last_error($res); inedi_mllpserver_get_last_error_code($res); inedi_mllpserver_set($res, $id, $index, $value); inedi_mllpserver_get($res, $id, $index); inedi_mllpserver_do_config($res, $configurationstring); inedi_mllpserver_do_disconnect($res, $connectionid); inedi_mllpserver_do_doevents($res); inedi_mllpserver_do_interrupt($res, $connectionid); inedi_mllpserver_do_reset($res); inedi_mllpserver_do_send($res, $connectionid); inedi_mllpserver_do_shutdown($res);
Remarks
The MLLPServer class is used to exchange HL7 data with one or more connected MLLP clients.
Setting up MLLPServer to Listen for Client Connections
The first step in using the MLLPServer class is to configure it to listen for MLLP client connections. Start by setting the LocalPort property to the desired listening port. For multi-homed devices, also set the LocalHost property to the address of the network interface the MLLPServer class should listen on.
Next, optionally enable TLS/SSL with the SSLEnabled and SSLCert properties (MLLPServer supports client authentication with the SSLAuthenticateClients property).
Finally, set the Listening property to True to begin listening for client connections.
Connecting Example
mllpServer.LocalHost = "localhost"; mllpServer.LocalPort = 7777; // The following two lines are only necessary if using TLS/SSL. mllpServer.SSLEnabled = true; mllpServer.SSLCert = new Certificate(CertStoreTypes.cstPFXFile, "..\\path\\to\\cert.pfx", "password", "*"); mllpServer.Listening = true;
At this point the ConnectionRequest event will fire anytime a client wishes to connect (connection requests are accepted by default), and the Connected event will fire each time a client successfully connects.
While clients are connected, the server may interact with them by using their ConnectionId to interact with the class's properties.
Receiving Data
The MLLPServer class will automatically receive HL7 data sent from each client, and will automatically send acknowledgements back.
When the MLLPServer class is receiving data, immediately before data transfer begins the StartTransfer event fires. During data transfer, one or more Transfer events will fire. When data transfer is complete, the EndTransfer event fires. Any errors during data delivery will cause the Error event to fire.
Immediately before the server acknowledgement is sent the AckOut event fires. The Accept parameter of this event is used to determine the type of acknowledgement (ACK or NAK) to send back to the client.
HL7 data received by the MLLPServer class will be stored in one of the following ways:
- If an output file path has been set to the OutputFilename property, the data is written to that file.
- Otherwise, the data is stored in the OutputData property.
Sending Data
The MLLPServer class may also send data to MLLP clients. First, specify the data to send by doing one of the following:
- Set the InputFilename property to the path of a file with HL7 data.
- Set the HL7 data directly to the InputData property.
Once the data has been specified, simply call the Send method with the appropriate connection Id to send the HL7 data to the associated client. Once the client has received the data, it will respond with an acknowledgement, causing the class's AckIn event to fire.
Sending Data Example
mllpServer.Connections[connectionId].InputData = "HL7Data"; mllpServer.Send(connectionId);
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
ConnectionCount | The number of records in the arrays. |
Connected | Triggers a connection or disconnection. |
ConnectionId | The Id of the connection. |
InputData | The raw HL7 data to send. |
InputFilename | The path of a file containing HL7 data to send. |
LocalAddress | The address of the local interface through which the connection is passing. |
OutputData | The raw HL7 data received. |
OutputFilename | The path of a file in which to store received HL7 data. |
RemoteHost | The address of the MLLP client associated with the connection. |
RemotePort | The port of the MLLP client associated with the connection. |
Timeout | The timeout value, in seconds, for the connection. |
DefaultTimeout | An initial timeout value to be used by incoming connections. |
KeepAlive | When True, KEEPALIVE packets are enabled (for long connections). |
Listening | If True, the component accepts incoming connections on LocalPort. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
LocalPort | The TCP port in the local host where the component listens. |
SSLAuthenticateClients | If true, the server asks the client(s) for a certificate. |
SSLCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertStore | The name of the certificate store for the client certificate. |
SSLCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
SSLCertStoreType | The type of certificate store for this certificate. |
SSLCertSubject | The subject of the certificate used for client authentication. |
SSLEnabled | Whether TLS/SSL is enabled. |
Version | The MLLP version to use. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting . |
Disconnect | Disconnect the specified client. |
DoEvents | Processes events from the internal message queue. |
Interrupt | Interrupts a synchronous send to the remote host. |
Reset | Reset the component. |
Send | Send HL7 data to the MLLP client associated with the specified connection Id. |
Shutdown | Shuts down the server. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
AckIn | Fires immediately after receiving an acknowledgement from a client. |
AckOut | Fires immediately before sending an acknowledgement to a client. |
Connected | Fired immediately after a connection completes (or fails). |
ConnectionRequest | Fired when a request for connection comes from a remote host. |
Disconnected | Fired when a connection is closed. |
EndTransfer | Fires after incoming HL7 data finishes transferring. |
Error | Information about errors during data delivery. |
Log | Provides logging information. |
SSLClientAuthentication | Fired when the client presents its credentials to the server. |
SSLStatus | Shows the progress of the secure connection. |
StartTransfer | Fires before incoming HL7 data begins transferring. |
Transfer | Fires during incoming data transfer. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
ACKChar | The positive acknowledgement character. |
NAKChar | The negative acknowledgement character. |
StartBlockChar | The character that denotes the beginning of HL7 data. |
EndBlockChar | The character that denotes the end of HL7 data. |
EOLChar | The character that denotes the end of a message block. |
ReceiveTimeout | Maximum number of seconds to wait after receiving a StartBlockChar. |
LogLevel | The level of detail that is logged. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the component binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
UseIPv6 | Whether to use IPv6. |
TcpNoDelay | Whether or not to delay when sending packets. |
LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLProvider | The name of the security provider to use. |
SSLSecurityFlags | Flags that control certificate verification. |
SSLCACerts | A newline separated list of CA certificate to use during SSL client authentication. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
OpenSSLCADir | The path to a directory containing CA certificates. |
OpenSSLCAFile | Name of the file containing the list of CA's trusted by your application. |
OpenSSLCipherList | A string that controls the ciphers to be used by SSL. |
OpenSSLPrngSeedData | The data to seed the pseudo random number generator (PRNG). |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
SelectWaitMillis | The length of time in milliseconds the component will wait when DoEvents is called if there are no events to process. |
CodePage | The system code page used for Unicode to Multibyte translations. |
UseInternalSecurityAPI | Tells the component whether or not to use the system security libraries or an internal implementation. |