I am currently attending a Networking Class at a Universtity. I have been given some homework and been told to do it. I need some help because i am very new to C coding. I have gone through and programed in C and know the basics. Unfortunately i have a teacher that is not a teacher but a programmer. he just goes through the class telling stories and such and expecting that we already know what he is telling us. We have tried to tell him we don't understand and nobody has finished the homework because they don't know how. I am wondering if there is anyone on here that could at least help me through with the homework (if not on here possibly through email ) and could work me through the homework problem. I really want to be able to UNDERSTAND it i don't want to just take the easy way out and have someone write the code for me.

My teacher wrote super quickly one day the first part the homework and i will include it below because i cannot even get that to work. Im really stuck. if you would rather talk through email my email address is sedricbenson@hotmail.com. I would really appreciate any help you guys could give me on understanding programming a little better. What i mostly don't understand how to do is connect this to a server. ALSO I KNOW RIGHT NOW IT DOESN"T MAKE A DIFFERENCE NOW, BUT I AM ALSO PROGRAMMING WITH MACINTOSH X-CODE. IM NEW TO THIS TOO AND WOULD LIKE SOME HELP, although the code is the same for perl/c/c++ ect. I just know there might be a few different man calls etc.

Heres the homework problem and here the program that gave us in class. Please let me know if u can help. Thank you so much:


Homework #1:

Write a program which does not use the client/server model. This program will read a line from the terminal, call a function to process the line, and then write the results back to the terminal. The input line should have the format of : OPERATOR:STRING where the operators indicated operations to be performed on the string. The operators are: r to reverse the order of the string, and c to reverse the case of the letters (change uppercase to lowercase and lowercase to uppercase). The function that processes the line will return a result in the same character array followed by a new line.


NOW HERE IS THE CODE HE GAVE US IN CLASS:


#!/usr/bin/perl (used for windows to run program)
my $pid= fork();
print "after the fork call the pid = $pid\n";
if($pid ==0){
print "I am the child\n";
exit;
}
else {
sleep 1;
print "I am the paent and the child has the pid of $pid\n";
exit;
}

(PIPE PROGRAM) (for server)

#!/usr/bin/perl (used for windows to run program)
pipe READHANDLE,WRITEHANDLE;
my $pid = fork();
if($pid==0){
my $input;
print "child: I am the child\n";
close (READHANDLE);
while (<STDIN>){
$input=$_;
print"child: sending $input\n";
$input= ~ s/Ths/That/;;
print WRITEHANDLE $input;
exit;
}
else {
my $input;
print "parent: I am the paent and the child has the pid of $pid\n";
close(WRITEHANDLE);
$input= <READHNDLE>;
print "parent: read $input\n;
exit;
}


////////////////////


according to this teacher to connect the program to the server i should only have to include the following commands of which i don't know where to put:


Writing to and from a server:

require "mainfile.pl";

unlink ("myfifo.srv");
unlink("myfifo.srv");
system('mknod', "myfifo.srv", 'p;');
system('mknod', "myfifo.clt", 'p');
close(0);
open(WRITEHANDLE1, "> myfifo.clt;
open (READHANDLE1, "> myfifo.srv");
server (READHANDLE1
close (READHANDLE1
close(WRITEHANDLE
print "server



FINALLY I AM SUPOSED TO MAKE THE ABOVE HOMEWORK PROGRAM #1, CONNECT TO THE SERVER AND RUN, THEN I NEED TO MAKE IT WORK WITH PIPES, FIFO'S, UDP SOCKETS, AND TCP SOCKETS. I am giving all that he gave us on the homework information just hoping that you can HELP me to make sense of it and maybe finish this homework. I am willing to put in the time to finish the homework, i just am really stuck right now. Thanks for your help in advance.

Sedric