Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Init()
- {
- if (mClient != null)
- {
- mClient.Close();
- mClient = null;
- }
- MoogPacketManager.Instance.Init();
- Log.Instance.WriteInfo("Packet manager created");
- mClient = new TcpClient();
- }
- public void Reconnect()
- {
- if (mClient != null)
- {
- mClient.Close();
- mClient = null;
- }
- mClient = new TcpClient();
- Log.Instance.WriteInfo("Try to connect to " + mEndPoint);
- while (!mClient.Connected)
- {
- try
- {
- mClient.Connect(mEndPoint);
- Log.Instance.WriteInfo("Connected = " + mClient.Connected);
- }
- catch (ArgumentNullException exception)
- {
- Log.Instance.WriteError(exception.Message);
- Thread.Sleep(mWaitTimeout);
- }
- catch (ObjectDisposedException exception)
- {
- Log.Instance.WriteError(exception.Message);
- Thread.Sleep(mWaitTimeout);
- }
- catch (SocketException exception)
- {
- Log.Instance.WriteError(exception.Message);
- Thread.Sleep(mWaitTimeout);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement