NCG takes a file with a ".n
" extension as its only argument. It will
generate two files with the same name and extensions of ".c
" and ".h
".
ncg napi3.n
generates napi3.c
and napi3.h
overwriting any previous versions. The
files generated by NCG should not be edited because they will be
overwritten the next time it is run on the same source file. Changes should
be made to the ".n
" file and NCG rerun. The generated ".c
" and ".h
"
files are made read-only by NCG as a reminder not to edit them.
To compile the server daemon:
cc -DBESERVER -DPORTNUMBER=\"5000\" napi3.c smmsg.o -ltisp -o napi3d
To compile the client object:
cc -DBECLIENT -DPORTNUMBER=\"5000\" -c napi3.c
cc myapp.c napi3.o cmmsg.o -ltisp -o myapp
In both cases above the definition of PORTNUMBER to 5000 should be changed to whatever port your protocol will use. The client and server must agree for them to communicate. The specified port must not be in use by another service.
The PORTNUMBER may be numeric indicating a specific port number or
may be a symbolic name that is present in the local /etc/services
file or the NIS service maps. See your local man pages about "services"
and/or "getservent()
".