TCPSendMessage

Sends a data stream over a TCP/IP socket.

Syntax

[ Boolean] =  object.TCPSendMessage [ nMsgId = Integer], [nWhichSocket = Integer]

The TCPSendMessage method syntax has these parts:

Part Description
object An object expression that evaluates to the HL7 control.
nMsgId A integer expression that specifies the message Id.
nWhichSocket A integer expression that specifies which socket to read from(tcpClientSocket, tcpServerSocket)


Returns

Value Description
Boolean A boolean expression that specifies if the receive operation was successful or not.


Remarks

TCPSendMessage of an object is initiated at runtime. The TCPSendMessage method is used to send
a data stream over a TCP/IP socket.  The data stream is generated from an HL7 message structure.  The
data stream has to have evelope support or else the TCPSendMessage method will not work.

Example

Private Sub ShowMessage()
    Dim nSendMsgId As Integer
    Dim nRecvMsgId As Integer
    Dim sSeg As String
    Dim nCount As Integer
    Dim nFieldCount As Integer
    Dim sMsg As String
    Dim bSuccess As Boolean


    Hl7cntl1.EnvelopSupport = True

    nSendMsgId = Hl7cntl1.InitMessage

    Hl7cntl1.SetSegment nSendMsgId, "MSH"
    Hl7cntl1.SetField nSendMsgId, "|", 1
    Hl7cntl1.SetField nSendMsgId, "^~\&", 2
    Hl7cntl1.SetField nSendMsgId, "GPMS", 3
    Hl7cntl1.SetField nSendMsgId, "DEMO", 4
    Hl7cntl1.SetField nSendMsgId, "HL7DEMO", 6
    Hl7cntl1.SetField nSendMsgId, "19911030140014865", 7
    Hl7cntl1.SetField nSendMsgId, "ADT", 9
    Hl7cntl1.SetFieldComponent nSendMsgId, "A28", 9, 0
    Hl7cntl1.SetField nSendMsgId, "14001U090", 10
    Hl7cntl1.SetField nSendMsgId, "D", 11
    Hl7cntl1.SetField nSendMsgId, "2.2", 12

    Hl7cntl1.SetSegment nSendMsgId, "EVN"
    Hl7cntl1.SetField nSendMsgId, "A28", 1
    Hl7cntl1.SetField nSendMsgId, "19911030140014865", 2

    Hl7cntl1.SetSegment nSendMsgId, "PID"
    Hl7cntl1.SetField nSendMsgId, "1", 1
    Hl7cntl1.SetField nSendMsgId, "123", 3
    Hl7cntl1.SetField nSendMsgId, "Bill" & "^" & "Gates" & "^" & """", 5
    Hl7cntl1.SetField nSendMsgId, "01/01/1956", 7
    Hl7cntl1.SetField nSendMsgId, "M", 8
    Hl7cntl1.SetField nSendMsgId, "100 Microsoft Rd" & "^" & "Suite 100" & "^" & "Seattle" & "^" & "WA" & "^" &          "10010", 11
    Hl7cntl1.SetField nSendMsgId, "M", 16
    Hl7cntl1.SetField nSendMsgId, "111-11-1111", 19
    Hl7cntl1.SetSegment nSendMsgId, "PV1"
    Hl7cntl1.SetField nSendMsgId, "1", 1
    Hl7cntl1.SetField nSendMsgId, "PCP01", 7

    Hl7cntl1.SetSegment nSendMsgId, "GT1"

    Hl7cntl1.TCPSendMessage nSendMsgId, tcpClientSocket
    Hl7cntl1.DeInitMessage nSendMsgId


    nRecvMsgId = Hl7cntl1.InitMessage
   Hl7cntl1.TCPRecvMessage nRecvMsgId, tcpClientSocket
   
   If bSuccess = True Then
        If Hl7cntl1.FindSegment(nRecvMsgId, "MSA") = True Then
           MsgBox "MSA Found "
        Else
           MsgBox "MSA Not Found"
        End If
  End If
  Hl7cntl1.DeInitMessage nRecvMsgId
End Sub
.
..
...

 

Back to Home Page.

This page, and all contents, are Copyright © 1998 by Gary M. Gallagher.
Sparrow Technologies Incorporated - http://www.sparrow-technologies.com