nextgenhealthcare / connect

The swiss army knife of healthcare integration.
Other
868 stars 265 forks source link

Use TCP listener to send initial socket connection request to an Analyzer #6099

Closed hamzabawumia closed 4 months ago

hamzabawumia commented 4 months ago

I have a problem, I am using mirth connect on my computer. I understand that BC 5150 has the port set to port 5100 and the Analyzer always act as the server while LIS PC should act as a client.

Now how do i send an initial socket connection request from the Mirth TCP listener to the Analyzer so that the analyzer now knows where to send its results.

I have some java code to establish the connection but where do i put it? and how will the analyzer know which port to client is listening on ?

import java.io.*;
import java.net.*;

public class MyClient {
    public static void main(String[] args) {
        try {
            String AnalyzerIP = "192.168.1.100";
            int AnalyzerPort = 5150;

            Socket socket = new Socket(AnalyzerIP, AnalyzerPort);

            // Now you have a socket connection to your Mirth server!
            // You can send data over this socket.

            // Close the socket when done:
            socket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

from stackoverflow (https://stackoverflow.com/questions/63709033/where-to-set-mindray-bc-5150-hl7-communication-port-number-and-ip-address ) there is a comment that states that ; "Once the handshake is completed, the server will push the results through that socket to the client pc. " But how does the server know which port the client pc is listening on?

This is quite confusing to me. I have also worked with other analyzers before, and the setting was simple since the Analyzer had an interface to enter the exact LIS ip address and port number to send results.

jonbartels commented 4 months ago

This should be moved to Discussions since it is asking for help and not reporting a bug. https://github.com/nextgenhealthcare/connect/discussions

jonbartels commented 4 months ago

I thought about the problem. Would a TCP Listener running in "client mode" do what you need to do?

Using custom code is an option but I do not think you need it for your use case.

from stackoverflow there is a comment that states that

Please EDIT your post to include links to the stackoverflow threads or other documents you read when researching this problem.

pacmano1 commented 4 months ago

OP created discussion

hamzabawumia commented 4 months ago

jonbartels

Thank you so much. Your suggestion solved my problem. Sorry about posting my issue here. I have sent it to the discussion page. I am grateful for your help.