sending files

This is a discussion on sending files within the Networking/Device Communication forums, part of the General Programming Boards category; hi I'm writting a client server application in which the client can send files to the server (.jpg files included). ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    30

    sending files

    hi

    I'm writting a client server application in which the client can send files to the server (.jpg files included). the application is connection oriented..
    suppose I want to send an image file..
    how can I do that? do I have to read the image file, store it in an array of char and then use the send() function to send it to the server?

    thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,767
    Well there's no need to store the whole file in memory prior to sending it.
    You could just read the file one buffer at a time, and send that to the server.

    Start by sending the length of the file to the server, then all the bytes of the file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 10:52 PM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  3. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  4. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 09:44 AM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM

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