• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Gui-less daemon based on NSFileHandle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gui-less daemon based on NSFileHandle


  • Subject: Gui-less daemon based on NSFileHandle
  • From: John Axel Eriksson <email@hidden>
  • Date: Sat, 17 Dec 2005 17:02:18 +0100

Hi. I've written a simple socket server using NSFileHandle. So far I've been using the application kit and
an NSTableView for output (the data being posted to the server is in xml-format, so I'm also using NSXMLDocument).

It's really a very simple app for debugging Flash applications.

Now I would like to make it gui-less, i.e a daemon run from the terminal. What I don't understand is how to create the
run loop, which, when using application kit, is created automatically.

So I have only one simple class at the moment: SocketServer, and then I have the main function where I set it up.

The socket server uses NSNotifications for posting connection attempts etc. How do I write the main function so that
it doesn't exit immediately? How do I add the NSFileHandle to the currentRunLoop?

Yes, I'm a total newbie when it comes to Cocoa :-)

Thanks in advance!

/John


#import <Foundation/Foundation.h>
#import "SocketListener.h"

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
SocketListener *sListener=[[SocketListener alloc] init];
[sListener startServer];
[[NSRunLoop currentRunLoop] ?];

[pool release];
return 0;
}
_______________________________________________
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
  • Follow-Ups:
    • Re: Gui-less daemon based on NSFileHandle
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: Using Zip executable in Cocoa Application
  • Next by Date: Re: Using Zip executable in Cocoa Application
  • Previous by thread: Re: disc image APIs
  • Next by thread: Re: Gui-less daemon based on NSFileHandle
  • Index(es):
    • Date
    • Thread