NEED HELP...... Receiving data to a server. RRS feed

  • Question

  • Hi guys ,

    Im not overly experienced at all of this but im trying to nut out a bit of beneficial system here. 

    What i have is a machine that is sending me ASCII data via TCP. Now what i need to do is work out the best way for me to get this data onto a server in a format such as xml or json maybe?? from there i will have a website access this data and use it to put it into graphs.  Any guidance, tips or things i should be doing different would be greatly appreciated.    

    • Edited by scottyd13 Tuesday, December 3, 2019 11:06 AM
    Tuesday, December 3, 2019 11:05 AM

All replies

  • Hi

    if your final goal is to show data in graph,the data source of your graph could be database or web service,please let me know that how your machine save the ASCII data ,for example in database or file or ...?

    Tuesday, December 3, 2019 11:37 AM
  • well currently this is the part of the challenge that i am working through. currently my machine is just receiving the data, its not saving it currently . so i am open for input on the best way to do this please.  
    Tuesday, December 3, 2019 11:13 PM
  • Hi scottyd13, 

    Thank you for posting here.

    Acccording to your problem, I make a test on my side, and I use TCP to send data between two applications.

    Here’s the code, and you can refer to it.


        Sub Main()
            Dim content = "data"
            Dim client As TcpClient = New TcpClient
            Dim ipAddress = "your ip address"
            Dim port = your port
            client.Connect(ipAddress, port)
            Dim ns As NetworkStream = client.GetStream
            Dim btarr = Encoding.ASCII.GetBytes(content)
            ns.Write(btarr, 0, btarr.Length)
        End Sub


        Sub Main()
            Dim listener As TcpListener = New TcpListener(IPAddress.Parse("your id address"), your port)
            While True
                Dim client As TcpClient = listener.AcceptTcpClient
                If client.Connected Then
                    Console.WriteLine("Client have connected to server")
                End If
                Dim stream As NetworkStream = client.GetStream
                If stream IsNot Nothing Then
                    Dim recv = New Byte(255) {}
                    Dim bytes As Integer = stream.Read(recv, 0, recv.Length)
                    Dim result = Encoding.ASCII.GetString(recv)
                End If
            End While
        End Sub


    Besides, we can store object to database, then we can select object from the database and convert it to xml or json.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, December 4, 2019 2:46 AM