In this section, you will learn about the basics of TCP/IP based communication. This section will also discuss the roles of the client and server when implementing an HL7 interface, as well as the limits of TCP/IP.
Client or Server
When implementing an HL7 interface, your interface will either be acting as a Client or a Server.
A TCP/IP server is a program that listens on a TCP/IP port number receiving connections from clients. For instance, a web server is a special type of TCP/IP server that listens on port number 80. A TCP/IP server can have many different TCP/IP clients connected to it.
A TCP/IP client is a program that connects to a TCP/IP server. For instance, Netscape and Internet Explorer are TCP/IP client programs that connect to web servers. A TCP/IP client must specify both the host address or IP address, as well as the port number that it wants to connect to.
TCP/IP Server Usage Example
A typical example of where you might want to implement an HL7 server is when you want to receive an ADT (Admit/Discharge/Transfer) feed to extract, for instance, patient demographics. Typically, you would write your interface as a TCP/IP server. You would then listen on a port number that you could negotiate with your counterparty, and the device sending you the ADT messages will connect to your server. This means you need to give the host and port number that you are listening on to the administrator of the ADT feed so they know how to connect to you.
TCP/IP Client Usage Example
A typical example of where you might want to implement an HL7 client is when you want to send lab results to a HIS (Health Information System). The administrator of the HIS system would need to give you the host or IP address of their HL7 server and the port number that it is listening on.
One final point that confuses many people is how HL7 ACKnowledgment messages should be sent. It is important to understand that when a TCP/IP connection is established, it is a two-way channel of communication. When a client establishes a connection to a server there is one channel on which the client can send data to the server, and another on which the server can send data back to the client. This latter channel should be used to send ACK messages.
Sometimes it is necessary to implement both a client and a server component for your product’s HL7 interface. Avoid the temptation to follow some creative members of the computer community who use the client component to send back all the ACK messages. Your creativity will be someone else’s problem. This certainly happens in the real world, but if you have the choice, make use of the fact that you can use the second channel of communication to send back ACK messages, as this is a much cleaner design.