File Server Help

This is a discussion on File Server Help within the C Programming forums, part of the General Programming Boards category; Post your modified code please. And please indent it this time....

  1. #16
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Post your modified code please. And please indent it this time.

  2. #17
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    What do you mean by ident it? I don't see a c code tag if you mean that...?
    I haven't changed the select thing, and when I execute the client, it should, on connect, ask me for a file path, but it doesn't and it disconnects from the server

  3. #18
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129

  4. #19
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    If you mean with ident, making it more easy to read, I've pasted it in pastebin, so it's a little more colored and i won't be such a pain like reading this =P
    File server
    http://pastebin.com/m38107086

    File client
    http://pastebin.com/m7ff255f2

    Thanks for taking so much care about my doubts =P

  5. #20
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    ident is a program that indents. But you didn't indent your code. Luckily, I know how to make my editor indent code. Compare and contrast: http://pastebin.com/m16f63647

  6. #21
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    Ohh I see.. you tided the code a little xD, I'm using just gedit for editing, a simple notepad, that's why it's a mess xD
    Well.. what about my questions? =P

  7. #22
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    Well.. the main problem now is that it doesn't requests me for the filename and the client disconnects

  8. #23
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    You need to assume that send and recv will not send or recv all the bytes you want to. You have to send or recv it again then. So you have to get the return value of all the sends and recvs and do something with it. Read the man pages for send and recv.

    To do that, go to a shell prompt and type:

    man 2 send

    and then

    man 2 recv

    > char buff[1048576]; // ?? memaloc

    Yes, you should malloc it; it might be too large for the stack.

  9. #24
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    I have typed what you said but it says the manual doesn't exist, what are you saying that is my main problem here? the program is not sending and recieving anything?
    Maybe you mean a loop until it get a response
    Last edited by lautarox; 09-10-2008 at 02:13 PM.

  10. #25
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    What OS are you running this under?

    Try just

    man send

    and

    man recv
    Last edited by robwhit; 09-10-2008 at 04:13 PM.

  11. #26
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    I'm under linux, and that command doesn't work neither

  12. #27
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    We mean to type this at the terminal, not put it in your program? Can you do "man man"? I've never seen a linux that didn't have man pages.

  13. #28
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You can do custom installations without man installed. Though, if you know how to accomplish the task of omitting the man pages at installation, you probably are familiar enough with linux to put them back or use them... or go online to use them, for that matter.

    What specific OS?

  14. #29
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    I'm using ubuntu 8.04, and man man works, but what can I get from doing that? man refers to manual? do I have something wrong in my code?

  15. #30
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Open synaptic and make sure you have all the libraries and man pages for your C standard libraries and linux standard libraries installed too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

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