Solved

C under Unix

Posted on 1999-01-19
3
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 80 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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…
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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