Advertisement
Guest User

Untitled

a guest
Jan 9th, 2014
13,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. private static void runCallback()
  2. {
  3. while (true)
  4. {
  5. logInfo("Sending callback data to master server.");
  6. try
  7. {
  8. string json = "json={\"version\":\"" + VersionNum + "\"," +
  9. "\"protocol\":\"" + ProtocolVersion + "\"," +
  10. "\"mono\":\"" + IsMono + "\"," +
  11. "\"proxyPort\":\"" + config.proxyPort + "\"," +
  12. "\"maxSlots\":\"" + config.maxClients + "\"," +
  13. "\"clientCount\":\"" + clientCount + "\"}";
  14. byte[] buffer = Encoding.UTF8.GetBytes(json);
  15.  
  16. WebRequest request = WebRequest.Create("http://callback.avilance.com/");
  17. request.ContentType = "application/x-www-form-urlencoded";
  18. request.Method = "POST";
  19. request.ContentLength = buffer.Length;
  20. Stream streamWriter = request.GetRequestStream();
  21. streamWriter.Write(buffer, 0, buffer.Length);
  22. streamWriter.Close();
  23. }
  24. catch (Exception e)
  25. {
  26. logDebug("Callback", e.ToString());
  27. }
  28. Thread.Sleep(1000 * 60 * 15);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement