Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to receive data sent by an Instrument(Cell Counter) which acts as a Client and Sends Data in HL7(Uses MLLP Protocol) Format to a LIS Server Which i am Developing in c#. However My server works fine when receiving normal Text messages. I've Searched on google but many solution were for sending HL7. I didn't found much about receiving HL7(MLLP) Data If Anybody Knows How to achieve this please share code Here is my Server Code:


What I have tried:

using System;
using System.IO.Ports;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Linq;
using System.Text.RegularExpressions;
using SimpleTCP;
using System.Net;
using System.Net.Sockets;

namespace RS232communication
{
public partial class Form1 : Form
{

   
    string datain;

   // TcpListener server = null;

     SimpleTcpServer server;
     private void Form1_Load(object sender, EventArgs e)
     {
        this.WindowState = FormWindowState.Maximized;     
        button2.Enabled = false;
        button1.Enabled = true;
        textBox1.ScrollBars = ScrollBars.Vertical;
        textBox3.ScrollBars = ScrollBars.Vertical;
        server = new SimpleTcpServer();
        server.DataReceived += Server_DataReceived;
    }

    private void Server_DataReceived(object sender, SimpleTCP.Message e)
    {
        datain = e.MessageString;
        this.Invoke(new EventHandler(showdata));
    }

  

    private void button1_Click(object sender, EventArgs e)
    {
        IPAddress ip =IPAddress.Parse(comboBox1.Text);
        server.Start(ip, Convert.ToInt32(comboBox5.Text));
       // server = new TcpListener(IPAddress.Parse(comboBox1.Text), 
     Convert.ToInt32(comboBox5.Text));
        server.Start();
        
        button2.Enabled = true;
        button1.Enabled = false;
        textBox2.Text += "Server Started";
    }
Posted
Updated 9-Mar-22 22:13pm
Comments
Richard MacCutchan 10-Mar-22 3:55am    
What exactly is the problem?

1 solution

MLLP is Minimal Lower Layer Protocol used in transmitting Health Level Seven (HL7) messages via TCP/IP. And your code does not follow that protocol.

If you have had googled, you would have found tons of articles elaborating what MLLP is and how to implement it in correct way.

Below link could be a good point to start as it explains the protocol in simple way along with a sample as well.

c# - How to implement send and receive hl7 data in .NET in ssh connection - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900