Java - Sockets, Servers, and Clients

Discussion in 'Programming' started by forseth11, Jun 21, 2015.

  1. I am wanting to create a special chat plugin for minecraft servers, but before I begin I want to know if something is possible. Is it possible for a client to connect with multiple servers over the same port? If not then would it be save (not laggy) to have about 1,000 clients connect to a single server to send messages through. What server would work best for this?

    Finally, with most minecraft hosting companies, how many different ports are open for plugins to use?

    Thank you for you help.
     
  2. Tux

    Tux

    A client can connect to multiple servers, but that's not very efficient in your case.

    You can have multiple connections to one server just fine, just don't use Java's ServerSocket, because it's a poor choice. Use something like Netty.
     
    • Like Like x 1
  3. Okay.
    To further clarify, can something like this work:

    Client (1.1.1.1:1000) -> connects to Server (2.2.2.2:1000)
    Client (1.1.1.1:1000) -> connects to Server (3.3.3.3:1000)
    Notice how the client is the same ip and port connecting to two different servers. Is that possible?
     
  4. Tux

    Tux

    Yes
     
    • Useful Useful x 1
  5. Thank you.

    If it is not too much trouble, can you post code examples or a javadoc links for what I should use?
     
  6. Tux

    Tux