public void Start() { InitializeDefaultProperties(); isSendingCrashReport = false; isCheckingVersion = false; Socket = new AsynchronousSocket(); Socket.Connected += new EventHandler(socket_Connected); Socket.ConnectFailed += new EventHandler(socket_ConnectFailed); Socket.Disconnected += new EventHandler(socket_Disconnected); Socket.SendCompleted += new EventHandler(socket_SendCompleted); Socket.SendFailed += new EventHandler(socket_SendFailed); Socket.ReceiveCompleted += new EventHandler(socket_ReceiveCompleted); int port = -1; try { port = Convert.ToInt32(LocalSetting.Values.String["UpdateServerPort"]); } catch { return; } Socket.Connect( LocalSetting.Values.String["UpdateServer"], port, 10000); // Blocks until disconnected }
private static void StartThread(object objectPort) { int port = (int)objectPort; Socket = new AsynchronousSocket(); Socket.Connected += Socket_Connected; Socket.ConnectFailed += Socket_ConnectFailed; Socket.Disconnected += Socket_Disconnected; Socket.SendCompleted += Socket_SendCompleted; Socket.SendFailed += Socket_SendFailed; Socket.ReceiveCompleted += Socket_ReceiveCompleted; Socket.Connect(IPAddress.Loopback, port, 10000); // Blocks until disconnected }