I have a button, when I press the connect button, it gets connected to the server. When I press the connect button again, it's getting delay in connecting to the server. Below is the code to connect to the server:
public void setupSocket() {
try {
socket = new Client(Host, Port);
theStream = socket.GetStream();
theWriter = new StreamWriter(theStream);
theReader = new StreamReader(theStream);
socketConnect = true;
}
catch (Exception e) {
Debug.Log("Socket error:" + e);
}
}
And I have one more issue. When I take the desktop build of the app and opened the app, clicked button, it's getting connected to the server, but when I click the button again it's not getting connected. But when I close the app, it displays the connection message and also close message on the server. Is there anything to be set when taking the desktop build?
Can anybody help out what will be the problem?