Class TCPClient

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, SocketClient

    public class TCPClient
    extends java.lang.Object
    implements SocketClient
    A client that would connect to a TCP socket.
    • Constructor Summary

      Constructors 
      Constructor Description
      TCPClient​(Endpoint endpoint)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected java.net.Socket createSocket()  
      void sendMessage​(java.lang.String message)
      Send a message through the Socket Client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TCPClient

        public TCPClient​(Endpoint endpoint)
    • Method Detail

      • createSocket

        protected java.net.Socket createSocket()
      • sendMessage

        public void sendMessage​(java.lang.String message)
        Description copied from interface: SocketClient
        Send a message through the Socket Client.
        Specified by:
        sendMessage in interface SocketClient
        Parameters:
        message - The message to be sent
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException