简体   繁体   中英

Send HL7 using VB.NET with MLLP

i am trying to send hl7 using vb.net with mllp , can anybody tell me that is the wrong of my code

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

You exchanged endblock and returnblock. So swap them

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

As I am not familiar with Visual Basic, I do not guarantee that the syntax definition of your blocks is correct, could also be &H0D or similar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM