Johnson, Tracy wrote:
> A vendor asked me how to create a port on an HP3000 so he can enable his software
> to use TCP.
>
> After little thought, I told him to edit SERVICES.NET.SYS on the machine in question
> and add a line with the port number he wants to use, and whether it is TCP or UDP
> (per the other lines in the file.) And appende with a '#' to if he wants to
add a
> comment. He can name the service anything he wants, (as long as it does not
conflict
> with an existing service name.)
>
> Was I correct in this, or was I way off?
Definitions of create a port:
1. Creating an entry in SERVICES allows software to call the routines
getservent, getservbyname, and getservbyport, to get the name,
port number and protocol information defined.
Once done, software like inetd can reference the name in its own
configuration (INETDCNF).
This really is just a naming scheme, allowing different sites to
define a common name, but may use different port numbers.
So this does not really create a port.
You can change (well, should be able to) the port numbers used by
inetd for echo, daytime, ftp, telnet, etc., by changing the port
assignment in SERVICES.
[It is possible to change the ports for NS services as well, like
NS/VT 1570 to something else. But depending on the version of
your emulators, you may not be able to match it.]
2. Use the BSD socket library, SOCKETRL.NET.SYS or SOCKETXL.NET.SYS, and
code in the calls needed to create a server.
socket () << get a socket >>
bind () << assign to it a port number >>
listen () << create a listening port >>
sclose () << close the listening socket/port >>
[This creates the port. Of course you need to continue to get a connection,
and to exchange data.
accept () << accept incoming connection >>
send () / recv () << exchange data on TCP/IP >>
sclose () << close connected socket >>
]
http://docs.hp.com/en/32650-90372/index.html
3. Use NetIPC intrinsics to create a port.
INITOPT () / ADDOPT () << set IP addr and port >>
IPCCREATE () << create socket/port >>
IPCCONTROL () << change default 60 sec. timeout >>
IPCRECVCN () << wait for a connection >>
IPCSHUTDOWN () << close socket/port >>
http://docs.hp.com/en/5958-8600/index.html
4. Create an inetd program/daemon to handle connections, define it in
INETDCNF with your designated port defined in SERVICES.
Let inetd create your port and pass it onto your daemon program.
[I'm not sure about other languages (but fairly certain), that for C,
it must be a posix program or rather it must be a program
linked with the posix libc.a and libsocket.a libraries because inetd
passes the socket to your program as stdin; and the MPE C library
wasn't updated to handle sockets for $STDIN]
As to your question,
> Was I correct in this, or was I way off?
I don't think I'm qualified to answer.
Keven Miller [log in to unmask]
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|