TCP IP COMMUNICATION USING VB.NET

deepu Lovelesh
deepu Lovelesh used Ask the Experts™
on
I HAVE A HAEMTALOGY ANALYZER WITH RJ45 PORT. I NEED TO RECEIVE DATA FROM THAT MACHINE TO MY VB.NET PROGRAM. KINDLY SHARE THE CODE FOR THE SAME SO THAT I CAN GET THE DATA AND RESTRUCTURE THE SAME AS PER MY REQUIREMENT.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Steve WilliamsProduct Design Engineer

Commented:
What types data are you trying to receive? Have you checked with the equipment manufacturer to see if they have an SDK for this?

Author

Commented:
Yes the equipment manufacturer is having the sdk for this and communication is possible. but i need the code where to receive the raw data.
Steve WilliamsProduct Design Engineer

Commented:
@deepu Lovelesh

The SDK is how you write the code to receive the data. With the SDK there are probably examples for your hardware. I know SDK's are not all free but if it is necessary for your business, it is a cost we all have to pay. Our company recently has been diving into auotmating processes and we have purchased many SDK's to acheive our goals, the end rsult so far has been well worth the cost.

 If you are not knowledgeable in coding or into developpement, my advice would be to find a person who is and have them explain the ins and outs on how this will happen.  Not all SDK  API's are the same. Each one is different and has to be reviewed before anyone can show you the code for your peticular application. It would be like trying to write a novel with out knowing the charachters or the plot. No one will know what the code is before reviewing the API.

Good Luck, hope this helps!
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Dear Steve

I just need to get the raw data only
after that i ll program everything myself.
Steve WilliamsProduct Design Engineer

Commented:
@deepu Lovelesh

What you may want to do is purchase Anarduino Uno and use this to capture the raw data and then you can write your application to receive the data in whatever format you need from the uno.  You can get a good unit for around $20. I use one to read raw data from a temp sensor and it relays the data back to my windows application through a USB port. Very handy item. I'm sure you could find someone with a similar project that may have a pinout from an RJ45 cable to your device.

Arduino has a great support forum and API. Lots of great information in the Arduino community.

Just an idea, roll it around a bit and let , me know what you think.

Author

Commented:
i just need to receive the data from a specific ipaddress on a specific port. my application not able to receive. please help
Steve WilliamsProduct Design Engineer

Commented:
@deepu Lovelesh

I guess I need to know more information in order to help you. How are you connecting this to the computer? You said "from a specific IPaddress through a specific port. ", yet you have not told us what the port is or the ip is. What code language are you writing this in? Your question is too vauge for anyone to answer. You need to supply us with any informtion that you have so that we can help. No one will answer you until you describe the requirement in better detail.

Author

Commented:
i had a haematology analyzer on network having ipaddress as 192.168.2.6 and my laptop having ipaddress as 192.168.2.4 and willing to receive data on port no 3600. i am using vb.net only
Steve WilliamsProduct Design Engineer

Commented:
How are these connecting through the network? Is the patch cable a straight through or crossover cable? Brand , model number of analyzer?

Author

Commented:
Sir thanks a ton for our interest. i am able to get the data but there is some data which represents a linear graph. can you help me to find out the solution to that using vb.net.

the data received for the graph is as under

"OBX|32|ED|15000^WBC Histogram. Binary^99MRC||^Application^Octer-stream^Base64^AAAAAAAAAAAAAAABAgQHDRcmO1Z3nMPg9P/98+HKsZl8aFdGMyUfHBwcHR8iJy02QUpLTU5PT09PTUxKSEZEQkBAPz4+PT09Pj49PDo5ODg3Nzg6PD5AQ0ZISUpMTU9RU1VWWFlZWlpaWlpaWlpbW1tbW1tcXV5fYGBhYWBgXl1bWVdVU1JQT01MSkhGREJAPj07OTg2NDMxLy0sKignJSQi"

or
"OBX|36|NM|15057^RBC Histogram. Total^99MRC||43822||||||F
OBX|37|ED|15050^RBC Histogram. Binary^99MRC||^Application^Octer-stream^Base64^AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAgIDAwUGCg4TGiIuOklYaX2OoLHD1OLu+P3//vny593Sw7Snmo1/dWthWFBJQjw2Mi8sKSclIyIgHx4cHBoaGBcWFBQTExISERAQEA8PDw4MDAsKCgoJCAgIBwcGBwcGBgYGBQQEBAQDBAMDAwMDAgICAgICAgEBAQEBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==||||||F"

or

"OBX|42|ED|15100^PLT Histogram. Binary^99MRC||^Application^Octer-stream^Base64^HR0MHQwMFB0VDAsMDxQiHRoVEAwLCwsMDg8QFBoiLB0cGhcVEhAODAsLCwsLCwwMDQ4ODw8QEhQXGh4iJywzHRwcGxoZFxYVFBIREA8ODQwMCwsLCwsLCwsLCwsLDAwMDA0NDg4ODw8PDxAQERITFBYXGRocHiAiJCcpLDAzOB0=||||||F
"


would really be thankful if you could help to create a graph from above sequence.
Steve WilliamsProduct Design Engineer

Commented:
I have attached a user manual for an analyzer I found online. I believe this is similar to the one you are working on. Am I correct?
371721735-BC-5800-LIS-Protocol-Manua.pdf

Author

Commented:
thanks a ton Steve but now i need the program that converts the base64 octal values given above to the linear graph. can you please help in that.
Steve WilliamsProduct Design Engineer

Commented:
@ deepu Lovelesh
give a couple days to work on this. I believe what your actually trying to do is decode the Base64 to octal values.

Here is an online convertor which shows the output I'm working on for you in vb.net.
base64_octal.PNG

Author

Commented:
Dear Steve

I need a graph from this which would look somehow like this.

so request you to kindly workout for that

"OBX|32|ED|15000^WBC Histogram. Binary^99MRC||^Application^Octer-stream^Base64^AAAAAAAAAAAAAAABAgQHDRcmO1Z3nMPg9P/98+HKsZl8aFdGMyUfHBwcHR8iJy02QUpLTU5PT09PTUxKSEZEQkBAPz4+PT09Pj49PDo5ODg3Nzg6PD5AQ0ZISUpMTU9RU1VWWFlZWlpaWlpaWlpbW1tbW1tcXV5fYGBhYWBgXl1bWVdVU1JQT01MSkhGREJAPj07OTg2NDMxLy0sKignJSQi"

it already tells that histograms are octer stream base64 strings in the first line.
IMG-20181110-WA0000.jpg
Steve WilliamsProduct Design Engineer

Commented:
@deepu Lovelesh

Ok I here is a link to download the sample vb.net project I created in MSVS 2017 community.

Click Here to download the project from my google drive.

Here is a screenshot of the form with the encoded data that has been decoded and shown in a decoded text field.
form.PNG

and here is a screenshot of the application in debug mode and viewing the contents of the datatable that contains the data harvested from the textbox string.

datatable-and-code.PNG
and finally here is the code from the form

Imports System.Environment
Imports System.IO
Imports System
Imports System.Text
Imports System.Data
Imports System.Windows.Forms.DataVisualization.Charting


Public Class FrmMain

    Public dt As New DataTable("TheData")

    Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
        Dim base64Encoded As String = txtEncoded.Text
        Dim data() As Byte

        'What you care about
        data = System.Convert.FromBase64String(base64Encoded)

        For i As Byte = LBound(data) To UBound(data)
            txtDecoded.Text += " " + Convert.ToString(data(i))
        Next

        Dim dText As String
        dText = txtDecoded.Text

        Dim ds As New DataSet()

        dt.Columns.Add("data")
        Dim nums As String() = dText.Split(New Char() {" "c})
        Dim num As String
        For Each num In nums
            dt.Rows.Add(num)
        Next

        chData.DataSource = dt
    End Sub
End Class

Open in new window


I apologize but I don't have any more time to spend on this as I was just handed a huge project and won't have the time. Hope what I did for you will get you pointed in the right direction and help you reach your goal. Good luck.
thanks Steve for our valuable time but i got another solution which worked for me.
Steve WilliamsProduct Design Engineer

Commented:
Thats good news deepu, glad you found what you needed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial