I am making a simple client to server set up in C#. I have two separate programs for both. I am trying to have my server have the ability to turn online or offline through the use of a checkbox. I have looked on the web and found that socket.blocking could be used? But I tried implementing it and it doesn't work. I get an error when I check the textBox to turn the server offline saying "Object reference not set to an instance of an object.". Here's the code in my checkbox function:
if (checkBox1.Checked)
{
server.Blocking = true;
}
else
{
server.Blocking = false;
}
Am I going about this the right way? I don't want the server to turn off but instead become unavailable to the client. Which is why I decided a blocking method would be best?
Any help would be greatly appreciated Thank you