Announcement

Collapse
No announcement yet.

vb script that works with windows but not ubuntu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    vb script that works with windows but not ubuntu

    I've been trying to write a script to send a push message out when a event is triggered. I currently have a test system running on my windows laptop and our "production" system is running on linux. This code works fine on the windows machine but will cause the linux install to stop working completely (stackoverflow and unhandled exception errors):

    Code:
    Imports System.IO
    Imports System.Net
    Imports System.Text
    Sub Main(parm as object)
    const debug = false
    const server = "XXXX"
    const postData = "{""token"": ""XXX"", ""user"": ""XXXX"",""message"": ""Garbage""}"
    ' Create a request using a URL that can receive a post.
    const server_url = "http://" & server & "/settings"
    Dim request As WebRequest = WebRequest.Create(server)
    ' Set the Method property of the request to POST.
    request.Method = "POST"
    ' Create POST data and convert it to a byte array.
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
    ' Set the ContentType property of the WebRequest.
    request.ContentType = "application/json"
    ' Set the ContentLength property of the WebRequest.
    request.ContentLength = byteArray.Length
    ' Get the request stream.
    Dim dataStream As Stream = request.GetRequestStream()
    Is there any way to get this to run in the ubuntu environment?

    #2
    Code:
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
    Due to issues with mono-vbnc, this line will crash HSConsole.

    https://forums.homeseer.com/forum/de...bnc-deprecated

    A workaround is to replace vbnc with the more up-to-date vbc.

    Code:
    sudo mv /usr/bin/vbnc /usr/bin/vbnc.old
    sudo cp -p /usr/bin/vbc /usr/bin/vbnc
    You may need to repeat this when upgrading mono. (not always but sometimes).

    Comment


      #3
      Perfect Thanks very much!!!!

      Comment

      Working...
      X