Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 777623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:38:09+00:00 2026-05-14T19:38:09+00:00

I am currently trying to port a .Net app to Objective C and Cocoa.

  • 0

I am currently trying to port a .Net app to Objective C and Cocoa. I know the basics and have had little trouble with most things. But I’m having trouble retrieving data from the Web.

In C# I would use POST and GET to retrieve information from a server as such

byte[] buffer = Encoding.ASCII.GetBytes("someData");

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("url");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = buffer.Length;

Stream postData = request.GetRequestStream();
postData.Write(buffer, 0, buffer.Length);
postData.Close();

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());

while (!reader.EndOfStream)
{
   String data = read.ReadLine();
   //Do something such as an update on each line read in
}

reader.Close();
response.Close(); 

but I’m not having much luck finding a Cocoa equivelant. I have seen the use of things such as NSUrlDownload but all the examples I can find always show the download of the data as a single blocking function call. Where what I need is to be able to update things as I recieve data, not just wait for it all to arrive then deal with it. And ideally I would be able to deal with different types of data such as text or binary, so I need something similar to a stream that I can pass to a parser of some kind.

So my question is what is the equivelant of the C# code above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:38:10+00:00Added an answer on May 14, 2026 at 7:38 pm

    You need to use NSURLConnection and assign an object as its delegate. As the connection receives data, it will call the -connection:didReceiveData: delegate method which you can use to process the incoming data as necessary.

    You will need to build the HTTP POST request yourself. I have posted some code that shows how to do this in my answer to this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to port an app from asp.net to php, however I just
Currently I'm trying to port a web application(ASP.NET MVC) to windows azure and have
Currently I am trying to port some VB.NET code to C#. The struct looks
I'm new to using Razor and ASP.NET. I currently have a site I'm trying
I'm currently trying to port a C application to AIX and am getting confused.
I have been trying to write an app that periodically parses the contents of
I'm currently trying to 'port' my Java EE 5 Application from Jboss 6 M2
I'm currently trying to get my head wrap around Cassandra/thrift with Erlang... I have
I'm currently trying to port some C# codes involving usage of DeflateStream into standard
I have installed Visual Studio .NET 2005. But when I am trying to execute

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.