Andrew Lalis
Andrew Lalis

Reputation: 974

In kryonet, how do I disconnect from a server without stopping my program?

I am trying to make a simple TCP chat program, and I want the user to be able to start the program, then be able to enter a specific ip to connect to, and then disconnect from that specific server, and then connect to another after that.

I know that the client is connected once it runs client.connect(timeout, ip, port), but the only way I know of to disconnect the client from the server is by exiting the program.

Is there any way to do this?

Upvotes: 0

Views: 709

Answers (1)

BeforeBigBang
BeforeBigBang

Reputation: 108

You can use client.stop(); to disconnect

Upvotes: 2

Related Questions