POSTing into a server from COCOA
POSTing into a server from COCOA
- Subject: POSTing into a server from COCOA
- From: deepak gopal <email@hidden>
- Date: Thu, 14 Sep 2006 06:12:16 +0100 (BST)
Hi All
I am a Java programmer and I am new to Cocoa and Objective C. (Started off in August.) I am trying out few things in CurrencyConverter project in the Cocoa examples.
The basic currency converter is a simple multiplier which multiplies two values and gives the result. We write the conversion code in the .m class class in the project.
But now I want to use Cocoa as the front end and connect to a Java server in the backend.
Here I would like to enter two values to be multiplied in the cocoa project window and would then POST the data (i.e the two values) to the server and get the result from the server and display the same.
I have been using NSURLConnection and its methods to connect to the server:
(I haven't yet found a way to pass the parameters, so I am just trying to connect to the server first)
These are the steps I follow:
1) NSString *urlString = [NSString stringWithCString:"http://172.19.23.36:8080/Mul/servlet/first"
];
2) NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
3) NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
But this doesn't work. i.e. its not connecting to the server.
I checked my connections through a browser and they are ok.
The tool gives a warning in the first step saying that selector [NSString stringWithCString] is not recognised. Its the same warning for all the NSString methods.
I have borrowed the codes given in the cocoa documentation and guides and from the sample codes available in ADC.
I am really confused I can't find a good way to connect to the my server and send a request to it. I have been spending a lot of time on this without getting any results.
Can anyone suggest/post a sample code with the same functionalities?
Thank You
Deep
---------------------------------
Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden