I was wondering if someone could point me in the right direction with my project:
I'm to write a simple client and server programs that will use sockets. The client will be able to sent a GET <file name> command to the server and the server will send back a file (which does not have to be ASCII characters).
I have basic knowledge of sockets, so I can send text messages back and forth, but I can't figure out how to transfer files.
Let me describe my understanding of what I should do so far, so that someone could tell me if I'm on the right track:
1. At first, I need to establish a socket between the server and client
2. Set server socket to listen
3. Client will open a local file (.bmp lets say) using fread() and save the whole thing into buffer
4. Client then will write() the buffer into the socket
5. Server will accept() that buffer and using fwrite() it will recreate the bmp
Is this the right flow of action? Do I need to handle splitting the buffer into smaller pieces for transfer or will sockets handle that themselves?