Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C under Unix

Posted on 1999-01-19
3
Medium Priority
?
200 Views
Last Modified: 2013-12-23
I want to write a program that provides services to it users such that:
1. The user inputs a known servername and service e.g time, daytime, whois, etc.
2. The program then interrogates the named server and requests for the service required by the user.
3. The server's output is then displayed on the user's display in an easy to read format.
0
Comment
Question by:galeboe
  • 2
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1583254
is
   csh -c "telnet rio.infodirekt.de 13 | & awk ' ( NR == 4 ) {print}'"
not sufficient?
0
 
LVL 1

Expert Comment

by:dotand
ID: 1583255
You didn;t write where is the problemastic part.
I think a simple two question program should work. First interogathe the user as to the machine name and later for the service name.
If you plan to offer only known in advance services that sit at specified ports you may simply encode the info as an array (associative or not is up to you).
Other-wise if the services are known services that sit at well known ports simply parse /etc/services for port number.

HTH,
Dotan
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 160 total points
ID: 1583256
#! /bin/csh -f
if ($#argv < 2) then
   echo "Usage: $0 hostname portnumber"
   exit(1)
endif
telnet $1 $2 |&awk '(NR == 4){print}
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question