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.