Method: SendHL7Message()

Name: SendHL7Message() - 2 Overloads

Parameters.1: intPortNumber (integer), strHL7Message (string)

Parameters.2: strSendToIP (string), intPortNumber (integer), strHL7Message (string)

Returns: Boolean

Description: If sending an HL7 message to an UltraPort Router running on the same computer use Parameters.1, to send to a remote computer (or a specific IP address on the same computer) use Parameters.2.

 

NOTES: The strHL7Message parameter must be ONE (1) fully formed HL7 message in a string beginning with an MSH segment which your application has created. HermeTech recommends using a toolkit like the EasyHL7 Managed Code objects for Visual Studio for this task. If the HL7 contained in strHL7Message is enveloped with   BOM and EOM characters (it is NOT required that they be) then they MUST match the values in the MessageBOM and MessageEOM properties. IMPORTANT: Sending HL7 data over TCP/IP is typically very, very fast (measured in milliseconds). The proxy toolkit connects to the router, sends the message, and waits for a short acknowledgement. And even though this roundtrip is usually very fast, you can use the WaitingForResponse event to 'break' this methods operation (as might be necessary if a form is closing OR a service is stopping, etc).

 

Click to see a VB.Net Example

   Private Function SendToLocalRouter(ByVal sMessage As String, ByVal nPort As Integer) As Boolean

       'sMessage is a fully formed HL7 message

       'nPort is the port number the UltraPort Router

       'is monitoring for proxy messages.

       'This method only works if the UltraPort Router is running on this computer

       Try

           Dim myProxy As New UPRTK.Net2005.RouterProxy

           With myProxy

               If .SendHL7Message(nPort, sMessage) Then

                   Return True

               Else

                   Return False

               End If

           End With

       Catch ex As Exception

           Return False

       End Try

   End Function

   Private Function SendToRemoteRouter(ByVal sMessage As String, ByVal sIPAddress As String, ByVal nPort As Integer) As Boolean

       'sMessage is a fully formed HL7 message

       'nPort is the port number the UltraPort Router

       'is monitoring for proxy messages.

       'This method can be used to send to any IP address

       'which can be connected to by any IP address on this computer

       Try

           Dim myProxy As New UPRTK.Net2005.RouterProxy

           With myProxy

               If .SendHL7Message(sIPAddress, nPort, sMessage) Then

                   Return True

               Else

                   Return False

               End If

           End With

       Catch ex As Exception

           Return False

       End Try

   End Function