Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
Hi,

I'm after a little guidance as to how best to make my application networkable. Trying to decipher the WiTap example is proving difficult and leaves me with some questions.

What is the general procedure for networking two instances of an application? I figure you use NSNetService/NSNetServiceBrowser to find a service, then use a TCP class to make the connection. Does the TCP class manage the peers or is that usually the job of the main application? Does the TCP class outline protocols (in the sense of how data is transferred (message layout) not as in cocoa protocols) translating input received over the connection into something more manageable for the application to act on?

A UML diagram of the WiTap sample would have been helpful :rolleyes:

Thanks for your time,

-Ross
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
Out of interest, NSConnection looks a whole lot easier than using CFNetwork to communicate across networks - is there any particular reason why we can't use NSConnection? For some reason it doesn't appear in my iphone os docs but I created an instance in my application and it compiled so I presume it is part of the iphone os?

-Ross
 

sujithkrishnan

macrumors 6502
May 9, 2008
265
0
Bangalore
Out of interest, NSConnection looks a whole lot easier than using CFNetwork to communicate across networks - is there any particular reason why we can't use NSConnection? For some reason it doesn't appear in my iphone os docs but I created an instance in my application and it compiled so I presume it is part of the iphone os?

-Ross

Hi Ross,

can u give me a snippet of the most native method of establishing a http connection to get an image (or any file) from a URL ?
I tried following line in my app, but INSTRUMENTS showing LEAK in the line.

This line is in the cellForRowAtIndex delegate method of a UITableViewCell...
INSTRUMENTS showing REALLOC as leak reason...

Code:
cell.image = [UIImage imagWithData:[NSData datafromURL:myURL]];

I broke down the statement into

Code:
NSURL *myURL = [[NSURL alloc]intWithString:myURLString];
NSData *dataImage = [[NSData alloc]initWithURL:myURL];
UIImage *imageTemp = [[UIImage alloc]initWithData:dataImage];
cell.image = imageTemp;
[imageTemp release];
[dataImage release];
[myURL release];

Still its showing mem-LEAK in SECOND line.....

So i planned to make my own connection (in native style and try...)
Or is there any other suggestion from you???
 

mpramodjain

macrumors regular
Nov 20, 2008
152
0
Banglore
Hi Ross,

can u give me a snippet of the most native method of establishing a http connection to get an image (or any file) from a URL ?
I tried following line in my app, but INSTRUMENTS showing LEAK in the line.

This line is in the cellForRowAtIndex delegate method of a UITableViewCell...
INSTRUMENTS showing REALLOC as leak reason...

Code:
cell.image = [UIImage imagWithData:[NSData datafromURL:myURL]];

I broke down the statement into

Code:
NSURL *myURL = [[NSURL alloc]intWithString:myURLString];
NSData *dataImage = [[NSData alloc]initWithURL:myURL];
UIImage *imageTemp = [[UIImage alloc]initWithData:dataImage];
cell.image = imageTemp;
[imageTemp release];
[dataImage release];
[myURL release];

Still its showing mem-LEAK in SECOND line.....

So i planned to make my own connection (in native style and try...)
Or is there any other suggestion from you???

Hi Sujith,

I am also having the same problem. Did you got your Own Connection or any solution for the above problem. If So Please help.

Thank You. :(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.