project doubts please !

B

Bharat Shetty

project doubt
1) ping all defined machines in the network from time to time, and
alert (by an indicator on a web page or screen) when some machine is
down
(2) periodically check HTTP and FTP ports of important machines (like
your intranet server) to verify that services are running and
responding properly
(3) can check if there is any networking problem like ping delay or
HTTP server responding slow
(4) sysadmins can add custom service ports (other than HTTP/FTP) to
their checklist
(5) your application will then check if those ports are open from time
to time
(6) sysadmins can also define ports which SHOULD NOT be open on any
machine, for example, IRC 666

This is what i am trying to code in C , can someone show me the way
how to start coding and proceed so that i can learn . I have coded
some sockets . yet am facing probs in coding this project ... details
on how to report error when a node in network timesout is highly
appreciated.

TIA

~bharat
 
C

Charlie Gordon

Bharat Shetty said:
project doubt
1) ping all defined machines in the network from time to time, and
alert (by an indicator on a web page or screen) when some machine is
down
(2) periodically check HTTP and FTP ports of important machines (like
your intranet server) to verify that services are running and
responding properly
(3) can check if there is any networking problem like ping delay or
HTTP server responding slow
(4) sysadmins can add custom service ports (other than HTTP/FTP) to
their checklist
(5) your application will then check if those ports are open from time
to time
(6) sysadmins can also define ports which SHOULD NOT be open on any
machine, for example, IRC 666

This is what i am trying to code in C , can someone show me the way
how to start coding and proceed so that i can learn . I have coded
some sockets . yet am facing probs in coding this project ... details
on how to report error when a node in network timesout is highly
appreciated.

Why do this in C ?
a shell script, or possibly some python or perl would be much easier for such a
task.
much simpler to maintain, configure and extend.
Furthermore, I'd be very surprised if packages for this purpose are not already
developped !

Chqrlie.

Don't use a surgeon's scalpel set to mow your lawn.
 
M

Malcolm

Bharat Shetty said:
project doubt
1) ping all defined machines in the network from time to time, and
alert (by an indicator on a web page or screen) when some machine is
down
This is what i am trying to code in C , can someone show me the way
how to start coding and proceed so that i can learn .
It is not really a C language problem, and the standard library provides no
support for networking. However many third party libraries are available.

The heart of the program would seem to be some technique for enumerating
machines on the network. How you would do this I have no idea, since I don't
do that sort of programming. Once you've got your list you can ping them
periodically. You can alert simply by writing to an HTML file. Similalry it
shouldn't be too much of a problem for an admistrator to save a list of
"important" machines to a data file somewhere, which your program
periodically reads.
 
B

Bharat Shetty

Charlie Gordon said:
Why do this in C ?
a shell script, or possibly some python or perl would be much easier for such a
task.
much simpler to maintain, configure and extend.
Furthermore, I'd be very surprised if packages for this purpose are not already
developped !

Chqrlie.

Don't use a surgeon's scalpel set to mow your lawn.

I want to do it in C , as per university norms. Could somebody tell me
how to start coding , reading for this project.
 
D

dandelion

Bharat Shetty said:
"Charlie Gordon" <[email protected]> wrote in message

I want to do it in C , as per university norms. Could somebody tell me
how to start coding , reading for this project.

First of all, you'll need a function that

1 Opens a TCP connection and returns an error code when this does not
succeed. Assuming you
have a POSIX socket lib, checkout socket(), bind(), connect()

2 Sends a request using the expected protocol on that port (HTTP, just ask
for a short page, FTP
send a 'ls'.

3 Pass the response to a protocol handler (not a complete one, but still) to
check wether the
response is a valid one. In this case, an appropriate error message (404,
for instance) would also
constitute a valid response. Return an error if the response wasn't valid.

4 Closes the TCP connection again.


So for each call to that function, you'd need

1. The TCP/IP address/port
2. An appropriate request
3. A (short) function to determine wether or not that response is valid for
the service expected

The latter (3) would be supplied in the form of a pointer-to-function. If
the demand is only to see wether or not a port is open, simply omit 2 and 3
and check the result status of connect(). If you can connect to an
address/port, then A) the server is up and running and B) the port specified
is "open".

This will give yo the main functionality. Now it should not be that hard to
poll servers and check the results.
 
F

Flash Gordon

On 15 Nov 2004 20:07:30 -0800

Networking is not defined by the C standard ans is highly OS specific.
Ask on a group dedicated to your system.


Not on this group. We only deal with the C language, not OS specific
extensions.
I want to do it in C , as per university norms. Could somebody tell me
how to start coding , reading for this project.

int main(void)
{
return 0;
}

We don't (as a rule) do coding for people even when it is possible in
standard C, we help when people have specific problems.

Write the code to read a configuration file detailing IP addresses and
we can help you with specific problems. For your networking problems you
will need to ask on a group dedicated to your system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top