Article View: comp.sys.next.programmer
Article #1455Re: Need a MINIMAL app for a speaker
From: Dave Griffiths
Date: Tue, 13 Oct 1992 21:43
Date: Tue, 13 Oct 1992 21:43
45 lines
1807 bytes
1807 bytes
In article <1992Oct8.050012.25265@unlinfo.unl.edu> hickman@cse.unl.edu (Hubert B. Hickman) writes:
>I am attempting to write a simple program that uses speaker/listener. This
>little program does not need to be a full-scale applcation, but simply
>needs to be able to send some messages to a remote application.
>
>My problem is that the port is never found. As of now, all of the
>code resides in the main.m file. There is no need for a nib file
>since this little executable has no user interface.
>
>Do I have to do somthing more to have a minimal "speaker"?
>
>Thanks,
>
>Hubert Hickman
>hickman@cse.unl.edu
>-----
>#import <stdlib.h>
>#import <appkit/appkit.h>
>#import <sys/port.h>
>
>void main(int argc, char *argv[]) {
>
>
> port_t websterPort;
> int scode,tcode,flag;
>
> NXApp = [Application new];
> websterPort = NXPortFromName("Webster",NULL);
> if(websterPort == PORT_NULL)
> {
> NXRunAlertPanel("Error",
> "Webster port not found, %s.\n",
> "OK",0,0,NXUserName());
> }
>
>[munch rest of code]
>
You have to do an [NXApp run]. At this point various initializations take
place which allow the NXPortFromName to work. So either put all your code
into the "appDidInit" method of some class, or create a class which sends
your NXApp a "stop:" message which will break it out of [NXApp run] so you
can fall through to the rest of your code.
Dave Griffiths
Technical Details
Message-ID:
<1992Oct13.214308.10566@prim>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!prim!daveReferences:
<1992Oct8.050012.25265@unlinfo.unl.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!prim!dave From: prim!dave@germany.eu.net (Dave Griffiths) Subject: Re: Need a MINIMAL app for a speaker Message-ID: <1992Oct13.214308.10566@prim> Organization: Primitive Software Ltd. References: <1992Oct8.050012.25265@unlinfo.unl.edu> Date: Tue, 13 Oct 1992 21:43:08 GMT Lines: 45