A simple socket question

flor

Registered
Hi, as so many i'm new to Cococa programming, but i started to like after doing the Currency tutorial.
I want to achieve a very simple task, here's what:
I want to connect to a webserver and display the returned HTML in a NSTextField. I setted up the interface, so all i need is the code.
Here's what i have so far:

#import "socketController.h"

@implementation socketController

- (IBAction)connectSocket:(id)sender
{
int thePort;
NSString *hostName;
NSSocketPort *theSocket;
NSConnection *theConnection;

thePort = [port_Field intValue];
hostName = [IP_Field stringValue];

theSocket = [[NSSocketPort alloc]initRemoteWithTCPPort:(unsigned short)thePort host:hostName];
theConnection = [NSConnection connectionWithReceivePort:theSocket sendPort:theSocket];

}
@end

What is the next step? How do i write to the webserver? How do i check the incoming data?

Help would be muchos appreciated!
Flor
 
Hi, thanks but i know that smallSockets would do the job fine. But i wanted to know, just for the sake of clarity, how it has to be done with only the Foundation framework, provided by Apple.

Would it be complicated?

Txs
 
Back
Top