Client-server application for hybrid file transfer

This is a discussion on Client-server application for hybrid file transfer within the C Programming forums, part of the General Programming Boards category; Hello, i need to write a C programme which have to support TCP protocol for command exchange and UDP protocol ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    10

    Client-server application for hybrid file transfer

    Hello, i need to write a C programme which have to support TCP protocol for command exchange and UDP protocol for data transferring. Server side must have two text file which are configuration parameters of it and other file will include login name and password details. Server application will operate like FTP Servers. After client initiate connection, server will send welcome message to client and after that the client must enter username and password (if username and password is matching from the text file, client will be authenticated). I have the sample codes but i don't know where to start. Can you give me some information about this? I'm also sending the details about this project RapidShare: 1-CLICK Web hosting - Easy Filehosting. Any help would be appreciated and please help me because passing this lecture depends on this project. Thanks in advance...

    Edit: I also attached the file.
    Attached Images Attached Images
    • File Type: pdf c.pdf (45.1 KB, 485 views)
    Last edited by ejjjjj; 05-15-2010 at 06:40 PM.

  2. #2
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    I took a look at your homework assignment; good luck getting anyone here to do it for you. That said, your requirements above are missing some huge details that in the odd case you *do* successfully get someone to do your homework for you they will be ticked off when they find out that:
    1. It can be C OR C++ (the latter is way easier to implement this kind of system.
    2. This system needs to be multithreaded so it can handle multiple concurrent users. Side note: I would ask your teacher what is the max number of users you must support concurrent operation with. If my boss were giving me a task like this, that would be an obvious question. Without it you will never know when you are "done" testing the app for robustness. Which leads to:
    3. A measurable level of robustness is expected from this system.
    4. Based on the requirements in that PDF file I can almost guarantee the instructor will be scanning this forum for this assignment/output code.
    5. It is not just that it must act like FTP servers; this system must support RFC 959: RFC 959 (rfc959) - File Transfer Protocol
    6. You cannot use any outside libraries (which is the first thing that most folks will reach for if given this task).
    7. Finally it is not enough just to say "Server side must have two text file(s) which are configuration parameters" when the requirements doc is very explicit how these files are to be laid out, the general config file format, etc.

    Any one of these points will cause someone to have to rewrite this and if you have a hard time getting someone to do it for you the first time, what are the odds you will be able to get them to do it again? I am not trying to be mean or an ass or anything, just preparing you for the inevitable. We love C/C++ and working with new coders, helping solve interesting problems and debugging tough situations. That said, I don't know that anyone here cares if you pass some lecture.

    Realistically from a strategic standpoint if you are going to do this yourself I would approach it like this:
    1. C++ definitely. If I wrote this system in C and later found out I could have used C++ I would be going postal. C++ lends itself to this kind of situation.
    2. Break down the client and the server side to see what modules they might have in common (for example, config file readers, general socket tools, maybe some IO (for screen input/output) libs.
    3. Write a simple test harness to test out the stuff in step 2. This will give you a foundation to build upon.
    4. Find out what platform you can write this on. Reason I ask is that if you use one that has pthreads available on it and all of the related tools like mutexes, semaphores, condition variables, etc) that will make the next step way easier. If you are stuck on Windows then things are going to have to turn to the left NOW due to the requirement of no outside libs unless you write them all yourself. Further, aside from some core system libs just being there or not on Windows, some things are implemented poorly on Windows like select() (this is just what the Windows peeps here say). Select will be your savior or your hell depending on if you can use it or not. The next step will illustrate why.
    5. Check out Beej's Guide to Network Programming

    Beej's guide to socket coding explains everything you need to do (aside from RFC 959) in a very conversational manner plus it gives you a lot of code snippets as well as working multithreaded servers and clients (which uses pthreads which is why I said what I did in #4 above). Learn this, study this and let it roll around in your head a bit before you go any further. This will given you some clues as to how you should proceed.
    6. As a side project I would write a simple library for parsing string input and calling functions based on what the string has in terms of a command. Yes this is for supporting RFC 959. The idea is to write a library (static or shared) that has a single public function called something like int parseLine(string strLine) which will break up the string and based on that will call (for example) int userName(string, nameStr), int passWord(string strPass), int port(int newPortNum), etc. IOW, one function for each supported command. The return variable int in each case is a result code of say SUCCESS = 0, FAIL = -1, BADPASS = -2, etc. What system you do is up to you. The point of all this is that you can test out and confirm the code that parses input and calls the right function works as specified in the RFC. Once it does, if you did it like I said, you can then take your library and your header file and drop it into your main project with a high-confidence that it will work.

    This should get you started and I need to go make dinner. Once you get this far if you need more help ask.
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I find it fascinating that they're far enough along in some sort of schooling to be given such a task, but have no idea where to start on it.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Quote Originally Posted by quzah View Post
    I find it fascinating that they're far enough along in some sort of schooling to be given such a task, but have no idea where to start on it.


    Quzah.
    Yeah that had me scratching my head too. Something doesn't seem right. I would also be curious to see what he/she refers to as 'example codes'.
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    10
    Thank you jeffcobb, you are absolutely right what you've said. The platform is Linux and neither Linux nor c++ aren't shown in our department. As you can easily guess in university a term is lasting 16 to 20 weeks maximum and if a lesson has 4 hours a week, which is for this lesson, it's just 80 hours maximum at total. The reason that i said this is i have to do it -searching, learning, etc.- all myself of course. I have the sample codes, internet connection but all i found is not in my native language, so it disturbs me and it's hard to understand too. I need help to start this programme -where to start, what to do- and thanks for what you've said again...

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    10
    Here are the 'example codes'...
    Attached Files Attached Files

  7. #7
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    PM me if you need any other guidance; I have a lot to share since this is the kind of thing I do for a living but didn't want to overwhelm you with data
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket Programming Problem!!!!
    By bobthebullet990 in forum Networking/Device Communication
    Replies: 2
    Last Post: 02-21-2008, 07:36 PM
  2. sending binaries files between server and client
    By nacho4d in forum C Programming
    Replies: 12
    Last Post: 01-31-2008, 01:54 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  4. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 05:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21