-1

I am writing a socket programming in C to transfer files from Server to Client. where client sends a filename to server and the server reply with the file content. I couldn't understand how a server can intimate the client when the file asked by the client is not found in server side. Do i have to use any standard to reply a package to client, where the client can understand that as a FileNotFound ?

EzLo
  • 13,780
  • 10
  • 33
  • 38
  • 1
    Maybe you should read up about the concept of [Communication protocol](https://en.wikipedia.org/wiki/Communication_protocol), e.g. messages, handshake, etc. – Stefan Becker Jan 29 '19 at 07:18

1 Answers1

0

In your communication model, you are missing a layer of meta-data or control messages. at the minimum, you need to pass a status code before you return the file. I suggest that you implement a simplified version of HTTP client. you can find an example at:

GitHub - reagent/http: Simple HTTP client in C

eyalm
  • 3,366
  • 19
  • 21