Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • 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
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. HttpRequest and Response in Windows Mobile

HttpRequest and Response in Windows Mobile

Scheduled Pinned Locked Moved C#
sysadminxmlannouncement
1 Posts 1 Posters 0 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
    Sri harini
    wrote on last edited by
    #1

    Hi I am developing Windows Mobile Application using VS2005. I am requesting File Details(XML output) from server, but the response is very slow. FileDetails Consist of File info and its Chunks Info. Can anybody suggests improvements in the below code to speedup the server response. public static void httpRequest(string uri, bool isGetMethod) { try { // Prepare web request... HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(uri); Console.WriteLine(uri); // We use POST ( we can also use GET ) if (isGetMethod) myRequest.Method = "GET"; else { myRequest.Method = "POST"; // Set the content type to a FORM myRequest.ContentType = "application/x-www-form-urlencoded"; Stream newStream = myRequest.GetRequestStream(); newStream.Close(); } // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse(); // Display the contents of the page to the console. Stream streamResponse = myHttpWebResponse.GetResponseStream(); // Get stream object StreamReader streamRead = new StreamReader(streamResponse); Char[] readBuffer = new Char[256]; // Read from buffer int count = streamRead.Read(readBuffer, 0, 256); while (count > 0) { //get string string resultData = new String(readBuffer, 0, count); HTTPClass.resultData = resultData; // Write the data Console.WriteLine(resultData); // Read from buffer count = streamRead.Read(readBuffer, 0, 256); } // Release the response object resources. streamRead.Close(); streamResponse.Close(); //Close response myHttpWebResponse.Close(); }

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


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups