C under Unix

Posted on 1999-01-19
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.
Question by:galeboe
  • 2
LVL 51

Expert Comment

ID: 1583254
   csh -c "telnet 13 | & awk ' ( NR == 4 ) {print}'"
not sufficient?

Expert Comment

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.

LVL 51

Accepted Solution

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some sers suddenly getting error popup msg 28 86
Creating and Connection two new domains 5 92
WLC 5508 controller configuration 4 75
This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

813 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now