/// <summary> /// Listens (and creates a server if needed) to remote connections. /// </summary> public void Listen() { if (WS != null) { throw new Exception("Cannot both be a server and a client." + " Please use Connect if you are connecting to a server or Listen to create a server."); } if (WSServer == null) { MakeServer(); } WSServer.Start(); DataSocket.Initialize(); }
/// <summary> /// Connects to the remote server as a client. /// </summary> /// <param name="address"></param> public void Connect(bool async = false) { if (WSServer != null) { throw new Exception("Cannot both be a server and a client." + " Please use Connect if you are connecting to a server or Listen to create a server."); } MakeClient(); if (async) { WS.ConnectAsync(); } else { WS.Connect(); } DataSocket.Initialize(); }