Implement the following programs to find the treasure... Note - you can try out Jeff's versions of the programs in the jeff subdirectory of ~cs473/h3/ Note - jeff's doesn't fully work with datagram yet. check_connection.c - Checks if a given connection will work. - Command-line arguments: protocol: stream | datagram method: unix | internet param1 param2 - If method is internet then param1 is hostname and param2 is port If method is unix then param1 is a file path - The program should try to connect to a socket with the given settings, send the message "hello" and check if a response of "acknoweledge" is received. - If the connection fails, print -1 - If the connection succeeds but the right response (or no response) is received, print 0 - If everything succeeds, print 1 - Note - for stream connection you should use select to check if there is a response, use the tv_sec parameter to allow for 2 seconds. Do not do a non-blocking read. If there is no response then exit. - Note - for datagram connection you should TBD get_connections.c - Connect to a given connection and read information from it. - Command-line arguments: same as check_connection.c - Open the connection, send the message "list connections" and read and print the results. - You can assume the list of connections will be a string that is at most 1000 characters. - Note - for stream connection you should again use select to check if there is a response, and use the tv_sec parameter to allow for 2 seconds. If there is no response then exit. - Note - for datagram connection you should TBD treasure_hunt.c - recursive function find_treasure + parameter is a string s + if s begins with "coin " then increase a global counter of the number of coins. there will be an integer next in the stream, add that to a global counter of the value of the coins, and return 1 + else - run check_connection.o with the string as parameter (using popen) - if returns 1 then run get_connections.o with the string as parameter (using popen) - for each line returned from get_connections.o, run recursive_function with this line, if recursive_function returns 1 then print the line (the connection string that succeeded) - return 0 - running on ds.indstate.edu, run find_treasure("unix stream /u1/class/cs473/h3/start_here")