Download Remote Microscope for Polymer Crystallization
Transcript
sends text messages to client, and most importantly it also sends binary data for displaying of the image. To do so, the server maintains two socket connections, one for text messages and the other for binary data. The server is also in charge of maintaining the state of the system, and of sending status and error messages to the client informing of the operations being performed, or of any problems that may arise with either the hardware or server software. The server class is where all the listening, reading and writing threads are fired. Figure 13 shows the threads that run in the server class. Main Server Program Listener Thread Listener2 Thread Reader Thread Writer Thread HTTP Thread Figure 13 - Server class threads Listener Thread Sits and waits for connection requests to arrive. When a new connection arrives, it informs the connection if the microscope is free or not by sending an OCCUPIED or AVAILABLE message. If the microscope is available it adds the socket to the list of client connections. 42