Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright (C) Paul Becker, - All Rights Reserved
- // Unauthorized copying of this file, via any medium is strictly prohibited
- // Proprietary and confidential
- // Written by Paul Becker <paul.becker1@gmx.de>, 08:13
- #region usings
- using System;
- using System.Collections.Generic;
- using System.Net.Sockets;
- #endregion
- namespace Assets.Network
- {
- internal class NetworkService
- {
- public static Connection CnxPreAlloc;
- public static void Start()
- {
- PacketHolder.Load();
- BeginAccept();
- }
- private static void BeginAccept()
- {
- try
- {
- CnxPreAlloc = new Connection(new TcpClient("127.0.0.1", 2106));
- UnityEngine.Debug.Log("Connected to the server");
- CnxPreAlloc.OnConnect();
- }
- catch (Exception)
- {
- CnxPreAlloc = new Connection(null);
- UnityEngine.Debug.Log("No Server avaible, reconnect later...");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement