Class ClientConnection



    Purpose

    To connect and disconnect a client to the server.

    Functionality

    To build a connection between a client and the server, the ClientConnection builds a socket and specifies a DataInputStream and a PrintStream to the socket.

    To disconnect a client to the server, the ClientConnection closes the DataInputStream and PrintStream and then set DataInputStream, PrintStream, and the socket to null.

    Structure

    Constructors

    ClientConnection has two constructors: One does nothing and the other takes the input parameters as the host machine and port and connect to that host machine.


    Methods

    connect: Connect to the specified host machine and port.

    disconnect: Break the connection between the client and the server.

    getOutputStream: Get the output PrintStream of the connecting socket.

    getInputStream: Get the input DataInputStream of the connecting socket.



    [Go to Class Index Table] [Go back to Program Architecture Diagram]
    [Source Code of ClientConnection.java]