In connecting to a network printer using AppSocket/HP JetDirect, how does one determine the host and port number?
The host is the printer itself. You have to configure the JetDirect card in the printer to a proper IP address. Is the printer use autoconfigure options (like dhcp - what mostly is a bead idea) you may print the configurtion of the JetDirect card from the printer status menu.
The port normaly is TCP/9100 for the raw-printing protocol. Have a look here for a overview of used ports.