Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Connect to gateway using VB.NET

Connect to gateway using VB.NET

Scheduled Pinned Locked Moved Troubleshooting
vb.netvisual basic
6 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sensorbuilder
    wrote on last edited by
    #1

    I am trying to develope my own controller SW using VB.NET 2012.

    Reading data from Gateway works perfect, using Sockets.NetworkStream and public function .GetStream(), but i do not suceed sending anything.

    When i try to send to gateway, i use function .Client.Send(<bytes>) where bytes are by command text string "20;1;1;1;2;0;\n" decoded to byte with the expression System.Text.Encoding.ASCII.GetBytes( "20;1;1;1;2;0;\n")

    When i connect to gateway using putty and a raw connection everything works fine.

    Does anyone have knowledge about VB.net and howto send command to gateway?

    1 Reply Last reply
    0
    • ch3b7C Offline
      ch3b7C Offline
      ch3b7
      wrote on last edited by
      #2

      You dont need send newline

      1 Reply Last reply
      0
      • ch3b7C Offline
        ch3b7C Offline
        ch3b7
        wrote on last edited by
        #3

        Use streamreader and streamwrite to read and send data over the networkstream

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Dirk_H
          Contest Winner
          wrote on last edited by
          #4

          Hi,

          I'm not 100% sure especially for Ethernet but shouldn't the string to send be:
          "20;1;1;1;2;0\n" (no trailing semicolon at the last argument).

          You can also check if the output of ASCII.GetBytes is ok. \n should get a 10 (dec). But this should work I think.

          1 Reply Last reply
          0
          • ch3b7C Offline
            ch3b7C Offline
            ch3b7
            wrote on last edited by
            #5

            im make a vb.net controller im try to help you with some code

            declare

            Public Swriter As StreamWriter
            Public Client As New TcpClient
            Public ClientStream As NetworkStream

            to send data use

            ClientStream = Client.GetStream()
            ClientStream.Flush()
            Swriter = New StreamWriter(ClientStream)
            Swriter.WriteLine(deviceid & ";" & sensorchildid & ";" & msgType & ";" & ack & ";" & subType & ";" & payload)
            Swriter.Flush()

            if you need more help tell me im try to help ^^

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sensorbuilder
              wrote on last edited by
              #6

              Hi,

              Thank you very mouch for your quick support!!
              Now it works perfect as expected :-)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              20

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular