I am implementing a network spooler printer in C linux.


  1. I would want to know how to queue different print requests coming from different clients to a multi threaded server and passing them onto a printer?

    for example pseudo code:
    thread1 is interacting with client1
    client 1 sends a file
    server creates a file and copies it their at its end
    server then queues the file path in a queue for processing by the printer
    client1 sends file1,server stores file1
    client1 sends file2,server stores file2

    queue: file1,file2
    Printer retrieves file1 and then file2 and then goes into wait state until a new arrives.
    Does the above make sense?linu
  2. How to address each client individually from a multi-threaded server?


For example client[1], client[2] etc., How to assign ID's for each client?
Someone told me that you should use threadid as clientid, is this a right approach?
3.How to simulate a document being printed ?
Any help would be highly appreciated!