Connect to gateway using VB.NET
-
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?
-
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.
-
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 NetworkStreamto 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 ^^
-
Hi,
Thank you very mouch for your quick support!!
Now it works perfect as expected :-)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login