DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006

    Connecting to a Server Program HELP

    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.


    #!/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";
    else {
    sleep 1;
    print "I am the paent and the child has the pid of $pid\n";

    (PIPE PROGRAM) (for server)

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


    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");
    system('mknod', "myfifo.srv", 'p;');
    system('mknod', "myfifo.clt", 'p');
    open(WRITEHANDLE1, "> myfifo.clt;
    open (READHANDLE1, "> myfifo.srv");
    server (READHANDLE1
    close (READHANDLE1
    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.


  2. #2
    Join Date
    Jan 2005
    Hi Cedric,
    I guess you are on the wrong forum here. The code you quoted is actually perl-script.
    I suggest you post on a relevant forum. Or do you want to translate the code into a C/C++ equivalent?

    Life is a short warm moment -
    Death is the long cold rest.
    Pink Floyd

  3. #3
    Join Date
    Nov 2006
    I would like to translate it to C code because i understand it better. Or i would like a little help understanding perl code. I haven't worked with perl before. but i have spent time with C code.



Similar Threads

  1. connecting to exchange server 2003 from vb.net
    By vasanthya_then in forum .NET
    Replies: 1
    Last Post: 04-17-2009, 04:15 AM
  2. Help with Server program
    By sedricbenson@ho in forum C++
    Replies: 2
    Last Post: 11-07-2006, 08:18 AM
  3. Replies: 2
    Last Post: 09-11-2006, 11:22 AM
  4. Replies: 2
    Last Post: 03-05-2001, 02:55 PM
  5. Remove exchange from a site
    By andriano in forum Enterprise
    Replies: 1
    Last Post: 10-02-2000, 03:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.