Package client

Class Connect

java.lang.Object
client.Connect

public class Connect extends Object
The connect class establishes a connection, via a TCP Socket, to the server and initialises a client. This client is then able to both send and recieve messages from the TCP server.
Since:
2023
  • Constructor Summary

    Constructors
    Constructor
    Description
    Connect(String name, String ip, int port)
    The constructor of the Connect object takes in 3 parameters and assigns them.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The startConnection method uses the IP, port and username given from the constructor.These are used within the creation of a new Client and Socket object.

    Methods inherited from class java.lang.Object

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

    • Connect

      public Connect(String name, String ip, int port)
      The constructor of the Connect object takes in 3 parameters and assigns them.
      Parameters:
      name - username of client
      ip - IP of server
      port - port of server
  • Method Details

    • startConnection

      public void startConnection()
      The startConnection method uses the IP, port and username given from the constructor.These are used within the creation of a new Client and Socket object. These are then sent to listen and send messages.