使用带有MLLP的VB.NET发送HL7

时间:2016-04-11 17:13:57

标签: vb.net tcp hl7 hl7-v2 mllp

我正在尝试使用带有mllp的vb.net发送hl7,任何人都可以告诉我这是我的代码错误

Dim StartBlock As String = "0x0b"  ' this is start block <SB>
Dim EndBlock As String = " 0x0d" ' this is end Block <EB>
Dim ReturnBlock As String = "0x1c" ' this is return  <CR>
Msg = StartBlock & Msg & EndBlock & ReturnBlock 


Dim networkStream As NetworkStream = tcpClient.GetStream()

If networkStream.CanWrite And networkStream.CanRead Then
    Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(Msg) 

    networkStream.Write(sendBytes, 0, sendBytes.Length)
end if

1 个答案:

答案 0 :(得分:2)

你交换了endblock和returnblock。所以交换它们

Dim EndBlock As String = "0x1c" ' this is end Block <EB>
Dim ReturnBlock As String = "0x0d" ' this is return  <CR>

由于我不熟悉Visual Basic,我不保证您的块的语法定义是正确的,也可能是&H0D或类似的。