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

CylonGlitch

macrumors 68030
Original poster
Jul 7, 2009
2,956
268
Nashville
Anyone have any simple network code? I have the need for a very simple network application in Objective.C. I have two applications that need to send some very simple data back and forth, nothing fancy, just simple communications. The applications don't need to search for each other, IP address can be supplied.

Basically something like a VERY simple chat app. You put in the IP address, and whatever you type, shows up on the other app's display. That's it.

Anyone know of where I can either find this code, or if someone has something already written that I can use as a foundation for my code.

Thanks!
 

chown33

Moderator
Staff member
Aug 9, 2009
10,753
8,436
A sea of green
Use AsyncSocket:
http://code.google.com/p/cocoaasyncsocket/

It's pretty easy to work with, if you have some Cocoa skills. The first time I used it, I was very new to Cocoa and Objective-C, but quite experienced with Java and other programming languages. I had it interoperating with Java networking apps in only a few days worth of playing with it.

Since you didn't indicate your skill or experience level, there's no way to tell what you will find easy.

You didn't indicate your network programming experience, either, so the idea of "a simple chat app" may not be as simple as you might think. It may seem simple on the surface, from a user perspective, but that isn't necessarily a reflection of what the code or design is like.

It's like arithmetic and algebra. If you know arithmetic, then ideas like variables and equations (relationships between variables) is at least explainable. But if you don't know basic arithmetic, then even rudimentary algebra is impossible to understand.

Oh, and get yourself a network traffic-watching tool. Old school command-line: tcpdump. Tool for anyone: Interarchy. More DIY: wireshark. You can google any of those.
 

CylonGlitch

macrumors 68030
Original poster
Jul 7, 2009
2,956
268
Nashville
Thanks for the information, I will download it and get going with it. I have some good Objective-C experience but I haven't gotten the networking stuff done yet. :D I did find some code at developer.apple.com but most of it seems to be a bit more complicated such as finding services automatically.

Thanks again!
CG
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.