Socketbased Printer Server Application Example PowerPoint PPT Presentation

presentation player overlay
1 / 8
About This Presentation
Transcript and Presenter's Notes

Title: Socketbased Printer Server Application Example


1
Socket-based Printer Server Application Example
Celsina Bignoli bignolic_at_smccd.net
2
The Application
  • makes a printer available over the network via a
    socket-based API

Server
Client
Printer
network
local connection
  • makes a User Interface available to the user
  • gets print requests
  • sends requests to the Server
  • receives print requests from the client
  • performs any necessary intermediate task
  • forwards requests to the printer

3
Basic Objects - Printer
  • public interface Printer extends PrinterConstants
  • public boolean printerAvailable()
  • public boolean printDocument(DocumentDescription
  • document) throws
    PrinterException
  • public class PrinterException extends Exception
  • private int _numberOfPages
  • private String _errorDescription

4
Basic Objects - Document
  • public class DocumentDescription
  • public static final int FAST_PRINTING 0
  • public static final int HIGH_QUALITY_PRINTING1
  • public static final int POSTCRIPT0
  • public static final int PDF1
  • private DataInputStream _actualDocument
  • private int _documentType
  • private boolean _printTwoSided
  • private int _printQuality
  • private int _length

5
The Protocol
  • The client sends an instance of
    DocumentDescription to the server
  • The Server sends back a response indicating
    weather the document was successfully printed
  • connection between client and server is closed
  • See printer application code, chapter 3

6
Application Architecture
Client
Server
User Interface
Client Network Wrapper
Server Network Wrapper
Implem. Printer Interface
network
Printer
7
New Features
  • More than one printer
  • Print Queue
  • Scalability
  • Tracking resource consumption

8
Code Changes
  • Mostly to deal changes in the protocol
  • add new methods
  • more marshalling/demarshalling of objects
  • Versioning issues
Write a Comment
User Comments (0)
About PowerShow.com