Hi all, I'm trying to get my head around the jsonrpc interface to LMS (
or whatever it's called ) having never done any Web programming it all
seems a bit of a black art but here is what I've tried with no success
it's c# 


Code:
--------------------
    
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Net;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace ConsoleWebRequest
  {
  class Program
  {
  static void Main(string[] args)
  {
  try
  {
  HttpWebRequest request = 
(HttpWebRequest)WebRequest.Create(@"http://10.10.1.11:9000/jsonrpc.js";);
  request.Credentials = CredentialCache.DefaultCredentials;
  request.ContentType = @"application/json";
  request.Method = "post";
  
  String JSonCommandStr = 
Squeezebox.Helpers.SqueezeMessage.CreateMessage("serverstatus");
  
  // This is the string that's returned from the above call
  //    
"{\"id\":1,\"method\":\"slim.request\",\"params\":[null,[\"serverstatus\"]]}"
  
  Stream stream = request.GetRequestStream();
  Byte[] bytes = Encoding.Unicode.GetBytes(JSonCommandStr);
  
  stream.Write(bytes, 0, bytes.Length);
  
  // I don't get any error but the connection times out
  WebResponse wr = request.GetResponse();
  
  
  }
  catch(Exception ex)
  {
  Console.WriteLine(ex.Message);
  }
  }
  }
  }
  
--------------------


any ideas guys ?



We can't stop here this is bat country. RIP Hunter S Thompson.
------------------------------------------------------------------------
pkfox's Profile: http://forums.slimdevices.com/member.php?userid=5346
View this thread: http://forums.slimdevices.com/showthread.php?t=104822

_______________________________________________
discuss mailing list
discuss@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/discuss

Reply via email to