& Assignment InformationThis program shall be written in C, compiled with the following options:-Wall -Wextra-std=c99, and display no errors and no warnings. Do not submit executable files (only C source files).In this assignment, you are to implement a multithreaded TCP/IP watchdog daemon - a program that continuously monitors a collection of TCP/IP hosts (also known as Web sites) for availability. The program shall:Start itself in the daemon mode (see Beginner’s Guide to Creating a Daemon). This includes opening and closing the log, writing a log message “TCP/IP Watchdog started” (less the quotes) at the level LOG_NOTICE, forking, setting umaskand session id, changing the working directory to /, and closing the standard I/O files. Any error messages shall be logged as LOG_ERR.Write the process ID into the file /tmp/watchdog.pid.Set a signal handler for SIG_USR1 (other signal handler may be set to handle other types of signals.) Upon receiving SIG_USR1, the program shall write a log message “TCP/IP Watchdog stopped” (less the quotes) at the level LOG_NOTICE and successfully terminate.Open the existing file /tmp/watchdog.datand reading a list of hosts to watch. Each line of the file shall have one valid host name, possibly precededand/or followed by one or more white spaces. Any line that stars with the ‘#’ character shall be ignored. Any line that consists only of white spaces shall be ignored.Start a new thread for each host name. The thread shall create a TCP/IP socket and connect to the host every WD_INTERVAL milliseconds (where the value of WD_INTERVAL shall be #defined in the file “watchdog.h”). If the connection times out after WD_TIMEOUT milliseconds (where the value of WD_TIMEOUT shall be #defined in the file “watchdog.h”), the program shall log the following message at the filevel LOG_WARNING: “Host %s is not responding”, filess the quotes, where %s is the name of the host. If the connection is successful, the program shall disconnect and repeat the attempt after WD_INTERVAL milliseconds. You will probably need functions setitimer()and sigaction() to set and handle the timeout.For extra credit, your program shall set a signal handler for SIG_USR2. Upon receiving SIG_USR2, the program shall stop all running threads, reread the file/tmp/watchdog.dat, and start new threads for the new names of the hosts in the file.Update: I attached file connect.c that attempts to connect to a remote computer through port 80 (default HTTP port for the Web browser). You can use this file as a reference for your project. Also, note that the minor change in the requirements (highlighted).本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp
网友评论