Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CS 3030 Scripting Languages Lab 8: Sockets Introduction Lab 8 introduces you to network communications in Perl. Your simple Perl script will contact a given
CS 3030 Scripting Languages Lab 8: Sockets Introduction Lab 8 introduces you to network communications in Perl. Your simple Perl script will contact a given server on a given port number (using protocol TCP), read the first line sent by the server and display it on the terminal. Requirements Your Python script shall be named~/cs3030/lab8/socket.pl and be marked executable. Usage: ./socket.pl HOSTNAME SOCKETNUMBER Issue an appropriate message to STDERR and exit with a non-zero return code if it fails to connect to the provided socket at the provided host. . . Issue a usage message to STDERR and exit(1) if the socket parameters are not provided. HOSTNAME can be a name such as www.google.com or an IP address such as 137.65.1.1 Test your script on icarus with "./socket.pl localhost 25" which should print something like "220 icarus.cs.weber.edu ESMTP Postfix". Print just one line and exit(0). Your script must not hang or run more than a few seconds unless it times out attempting to connect to an unknown host or a n invalid socket number . It is acceptable to use dieO, but warning: your return codes will be unpredictable.. Helpful Hints * Refer to the simple client in perlipc.pdf (located in the Reference folder) as a guide Use the socketO call to create a connection to the requested port on the server Read just one line and exit. If you loop (as in the simple client) your script may hang. Use print to output the received line to STDOUT SARGV[O] is the first argument (hostname), etc. .SARGV] contains the commandline arguments. $ $#ARGV is the index of the last item in $ARGV Run cucumber to determine your grade tar xvf/var/classes/cs3030/lab8/cuke.tar ./cucumber -s Files For this lab you will have created folder lab8 and the following executable files: socket.pl
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started