Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I'm writing a small C project for university purposes.
it consists in a simple Server-Client application on Linux, in which the Server holds/manages a database, and the Clients ask it for files. Server and Clients are linux executables, and for the exchange of messages, only 2 well known FIFOs are used (any private/dedicated fifo), with record lock on both to ensure mutual exclusion between the processes.
Now I need to write a small library that contains functions that the Clients need to use in order to interact with the Server, for example "login", "send", "receive", and so on.
This library is a static one, composed by source code + include file.
My question is:
where should the Client open the FIFOs? Should be opened inside the function library, or in the client code before calling any of those functions? and how to manage the file descriptors used when using library functions (assuming that a file descriptor is not an input parameter of those function) ?
I hope it is clear, sorry for my bad english.
0 · ·