示例#1
0
        public Boolean Connect()
        {
            var result = true;

            if (nethandler == null || netaddress == null || netport == 0)
            {
                result = false;
            }
            else
            {
                if (netconn == null)
                {
                    netconfig = new NetPeerConfiguration("AuthServer");
                    netconn   = new Lidgren.Network.NetClient(netconfig);
                    netconn.RegisterReceivedCallback(new SendOrPostCallback(nethandler), new SynchronizationContext());
                }
                try {
                    netconn.Start();
                    var hail = netconn.CreateMessage("Coming in hot!");
                    var conn = netconn.Connect(netaddress, netport, hail);
                    result = true;
                } catch {
                    result = false;
                }
            }
            return(result);
        }
 public void sendRequest(NetClient n, int id, byte property)
 {
     NetOutgoingMessage propertyMessage = n.CreateMessage();
     propertyMessage.Write(id);
     NetOutgoingMessage idMessage = n.CreateMessage();
     idMessage.Write(property);
     n.SendMessage(idMessage, NetDeliveryMethod.ReliableOrdered);
     n.SendMessage(propertyMessage, NetDeliveryMethod.ReliableOrdered);
 }
 public NetClient connectToServer(string ip, int port, string appname, int playernr, int entityID)
 {
     NetPeerConfiguration npc = new NetPeerConfiguration(appname);
     NetClient n = new NetClient(npc);
     n.Connect(ip, port);
     Debug.Log("Connected succesfully!");
     NetOutgoingMessage mess = n.CreateMessage();
     mess.Write(playernr);
     NetOutgoingMessage nm = n.CreateMessage();
     nm.Write(entityID);
     n.SendMessage(mess, NetDeliveryMethod.ReliableOrdered);
     n.SendMessage(nm, NetDeliveryMethod.ReliableOrdered);
     Debug.Log("Cleared identity with server!");
     return n;
 }
示例#4
0
        public static void Connect(IPEndPoint endpoint, MMDevice device, ICodec codec)
        {
            var config = new NetPeerConfiguration("airgap");

            _client = new NetClient(config);
            _client.RegisterReceivedCallback(MessageReceived);

            _client.Start();

            _waveIn = new WasapiLoopbackCapture(device);
            _codec = codec;

            _sourceFormat = _waveIn.WaveFormat;
            _targetFormat = new WaveFormat(_codec.SampleRate, _codec.Channels); // format to convert to

            _waveIn.DataAvailable += SendData;
            _waveIn.RecordingStopped += (sender, args) => Console.WriteLine("Stopped");
            // TODO: RecordingStopped is called when you change the audio device settings, should recover from that

            NetOutgoingMessage formatMsg = _client.CreateMessage();
            formatMsg.Write(_targetFormat.Channels);
            formatMsg.Write(_targetFormat.SampleRate);
            formatMsg.Write(codec.Name);

            _client.Connect(endpoint, formatMsg);
        }
示例#5
0
文件: Client.cs 项目: uwrov/teaching
        public static void Main(string[] args)
        {
            Console.WriteLine("[CLIENT] Testing Lidgren-Network-v3...");

            NetPeerConfiguration clientConfig = new NetPeerConfiguration("test");
            clientConfig.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
            NetClient client = new NetClient(clientConfig);
            client.Start();

            Console.WriteLine("IP to connect to: ");
            String ip = Console.ReadLine();
            client.Connect("192.168.1.2", 80);

            while (true)
            {
                if (client.ServerConnection != null)
                {
                    string msg = Console.ReadLine();

                    NetOutgoingMessage sendMsg = client.CreateMessage();
                    sendMsg.Write(msg);
                    client.SendMessage(sendMsg, NetDeliveryMethod.ReliableOrdered);
                }
            }
        }
示例#6
0
文件: Client.cs 项目: uwrov/teaching
        public static void Main(string[] args)
        {
            Console.WriteLine("[CLIENT] Testing Lidgren-Network-v3...");

            NetPeerConfiguration clientConfig = new NetPeerConfiguration("test");
            clientConfig.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
            NetClient client = new NetClient(clientConfig);
            client.Start();

            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            client.RegisterReceivedCallback(new SendOrPostCallback(GotMessage));

            Console.WriteLine("IP to connect to: ");
            String ip = Console.ReadLine();

            client.Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ip), 12345));

            while(true) {
                string msg = Console.ReadLine();

                NetOutgoingMessage sendMsg = client.CreateMessage();
                sendMsg.Write("[CLIENT] " + msg);
                client.SendMessage(sendMsg, NetDeliveryMethod.ReliableOrdered);
            }
        }
 public void SendUpdates(NetClient client)
 {
     NetOutgoingMessage om = client.CreateMessage();
     om.Write(Helpers.TransferType.ProjectileUpdate);
     om.Write(new ProjectileTransferableData(client.UniqueIdentifier,ID,IsValid,Position,Angle));
     client.SendMessage(om, NetDeliveryMethod.UnreliableSequenced);
 }
 public int Initialize(List<BaseUnit> VecUnits, Map map)
 {
     config = new NetPeerConfiguration("StarKampf");
     client = new NetClient(config);
     client.Start();
     client.Connect(host: "127.0.0.1", port: 12345);
     side = 0; //  later somebody need make ini side in moment connecting to the server // later means never // это типа комментарий к комментарию, ну вы поняли да?)
     outMsg = client.CreateMessage();
     unitsManager = new UnitsManager(VecUnits, map);
     return side;
 }
 public int Initialize(ref List<BaseUnit> VecUnits, Map map)
 {
     config = new NetPeerConfiguration("StarKampf");
     client = new NetClient(config);
     client.Start();
     client.Connect(host: "127.0.0.1", port: 12345);
     outMsg = client.CreateMessage();
     this.VecUnits = VecUnits;
     unitsManager = new UnitsManager(ref VecUnits, map);
     OutComingCommandAboutIni = string.Empty;
     return side;
 }
示例#10
0
文件: Program.cs 项目: JueZ/ITP
        public static void ConnectPlayerToLobby(string playername, Color playercolor)
        {
            NetPeerConfiguration config = new NetPeerConfiguration("chat");
            config.AutoFlushSendQueue = false;
            s_client = new NetClient(config);

            s_client.RegisterReceivedCallback(new SendOrPostCallback(LobbyForm.GotMessage));

            string hailmessage = guid.ToString() + ";" + playername + ";" + Convert.ToString(playercolor.ToArgb());

            s_client.Start();
            NetOutgoingMessage hail = s_client.CreateMessage(hailmessage);
            s_client.Connect(settings.ServerAdresse, settings.ChatPort, hail);
        }
 public bool Start()
 {
     var random = new Random(); 
     _client = new NetClient(new NetPeerConfiguration("networkGame"));
     _client.Start();
     Username = "******" + random.Next(0, 100);
     GroupId = "test";
     var outmsg = _client.CreateMessage();
     outmsg.Write(GroupId);
     outmsg.Write((byte)PacketType.Login);
     outmsg.Write(Username);
     _client.Connect("localhost", 14241, outmsg);
     return EsablishInfo(); 
 }
示例#12
0
文件: Client.cs 项目: Choochoo/Ship
        public void SetupClient(string gameName, string ip = "127.0.0.1", int port = 14242)
        {
            // Create new client, with previously created configs
            var config = new NetPeerConfiguration(gameName);
            _listOfOtherPlayers = new List<HeroEntity>();
            _client = new NetClient(config);
            _client.Start();

            // Connect client, to ip previously requested from user
            var outmsg = _client.CreateMessage();
            outmsg.Write(PacketType.Login);
            outmsg.WriteAllProperties(MainGame.MyHero.MyLoginInfo);
            _client.Connect(ip, port, outmsg);
        }
示例#13
0
		static void Main(string[] args)
		{
			var config = new NetPeerConfiguration("enctest");
			var client = new NetClient(config);
			client.Start();

			System.Threading.Thread.Sleep(100); // give server time to start up

			client.Connect("localhost", 14242);

			var encryption = new NetAESEncryption(client, "Hallonpalt");

			// loop forever
			while (true)
			{
				// read messages
				var inc = client.ReadMessage();
				if (inc != null)
				{
					switch (inc.MessageType)
					{
						case NetIncomingMessageType.DebugMessage:
						case NetIncomingMessageType.WarningMessage:
						case NetIncomingMessageType.VerboseDebugMessage:
						case NetIncomingMessageType.ErrorMessage:
							Console.WriteLine(inc.ReadString());
							break;
						case NetIncomingMessageType.StatusChanged:
							var status = (NetConnectionStatus)inc.ReadByte();
							Console.WriteLine(inc.SenderConnection + " (" + status + ") " + inc.ReadString());
							break;
					}
				}

				// if we're connected, get input and send
				if (client.ServerConnection != null && client.ServerConnection.Status == NetConnectionStatus.Connected)
				{
					Console.WriteLine("Type a message:");
					var input = Console.ReadLine();

					var msg = client.CreateMessage();
					msg.Write(input);
					encryption.Encrypt(msg);

					var ok = client.SendMessage(msg, NetDeliveryMethod.ReliableOrdered);
					Console.WriteLine("Message sent: " + ok);
				}
			}
		}
示例#14
0
文件: Program.cs 项目: JueZ/ITP
        public static void ConnectToServer()
        {
            NetPeerConfiguration netconfig = new NetPeerConfiguration("game");

            netclient = new NetClient(netconfig);

            if (SynchronizationContext.Current == null)
                SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());

            netclient.RegisterReceivedCallback(new SendOrPostCallback(ReceivedData));
            netclient.Start();

            NetOutgoingMessage message = netclient.CreateMessage("Connect");
            netclient.Connect(settings.ServerAdresse, settings.GamePort, message);
        }
示例#15
0
        static List<Player> players; //This will hold all players info from server

        #endregion Fields

        #region Methods

        static void Main(string[] args)
        {
            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            players = new List<Player>();
            Config = new NetPeerConfiguration("DND Server");//APP ID
            Console.WriteLine("Created Client Configuration.");
               // Config.Port = _SERVERPORT;
            Client = new NetClient(Config);
            Console.WriteLine("Initialized client socket");
            Client.RegisterReceivedCallback(new SendOrPostCallback(RecieveData));
            //Register the recieve callback.  Better if its before when the socket starts
            Client.Start();//start the socket
            Console.WriteLine("started the client socket");
            Client.Connect("localhost", _SERVERPORT);//connect the client to the server
            Console.WriteLine("Requesting Connection to server");
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            //An example input manager to get respont on console
            new Thread(new ThreadStart(delegate
            {
                string input;

                while ((input = Console.ReadLine()) != null)
                {
                    Console.WriteLine("Console input.");
                    string[] prms = input.Split(' ');//params for the input

                    switch (prms[0])//The first param is the command name
                    {
                        case "/changename":
                            //TODO: add code later
                            break;
                        case "/say":
                            NetOutgoingMessage outmsg;
                            outmsg = Client.CreateMessage();
                            outmsg.Write((byte)Headers.Chat);
                            string Message = "";
                            for(int i = 1; i < prms.Length; i++)
                                Message += prms[i] + " ";
                            Message += "\n";
                            outmsg.Write(Message);
                            Client.SendMessage(outmsg, NetDeliveryMethod.ReliableOrdered);
                                break;
                    }

                }
            })).Start();
            //END INPUT MANAGEMENT
        }
示例#16
0
 public bool Start()
 {
     Client = new NetClient(new NetPeerConfiguration("Battleship438"));
        Client.Configuration.EnableMessageType(NetIncomingMessageType.Data);
        Client.Configuration.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
        Client.Start();
        Player = new Library.Player("Kevin F", 20, 10);
        //TODO: NEED TO ACQUIRE PLAYER1/2 FROM SERVER
        var outMsg = Client.CreateMessage();
        outMsg.Write((byte)PacketType.Login);
        outMsg.Write(Player.Name);
        outMsg.Write(Player.X);
        outMsg.Write(Player.Y);
        Client.Connect("localhost", 14241, outMsg);
        return EstablishInfo();
 }
        public override void Start()
        {
            if (m_peer != null)
            {
                throw new InvalidOperationException("Client already running");
            }

            NetPeerConfiguration config = new NetPeerConfiguration(m_name);

            m_peer = new NetClient(config);
            m_peer.Start();

            NetOutgoingMessage hailMessage = m_peer.CreateMessage();
            hailMessage.Write(CVars.name.value);
            m_peer.Connect(m_remoteEndPoint, hailMessage);
        }
示例#18
0
        public static void Initialize(string ip, int port, string name)
        {
            Ip = ip;
            Port = port;
            Name = name;

            Disconnect();

            NetClient = new NetClient(new NetPeerConfiguration("LidgrenChat") {ConnectionTimeout = 5f});
            NetClient.Start();

            var hail = NetClient.CreateMessage(name);

            NetClient.Connect(Ip, Port, hail);

            NetClient.RegisterReceivedCallback(MessageReceived);
        }
示例#19
0
        public static void AutoDiscover()
        {
            var config = new NetPeerConfiguration("spacebargame"); // New Lidgren config
            Client = new NetClient(config); // Give NetClient Client our NetPeerConfig config

            NetOutgoingMessage msg = Client.CreateMessage(); // msg is the outgoing message
            Client.Start(); // Boot the client

            Thread.Sleep(500); // Sleep 500

            if (!NetworkingThread.IsAlive)
            {
                Thread NetworkingThread1 = new Thread(NetworkReceive);
                NetworkingThread1.Start(); // Start NetworkingThread for incoming messages.
            }

            Thread.Sleep(500); // Sleep 500
            Client.DiscoverLocalPeers(666);
        }
示例#20
0
        public NetworkConnection(string playerName, IPEndPoint connectTo)
        {
            if (connectTo == null) throw new ArgumentNullException(nameof(connectTo));

            SendBuffer = new Event[1];
            EventQueue = new Queue<Event>();

            NetPeerConfiguration config = new NetPeerConfiguration("helium_third_game");
            config.EnableMessageType(NetIncomingMessageType.Data);
            config.EnableMessageType(NetIncomingMessageType.StatusChanged);

            Client = new NetClient(config);
            Client.Start();

            IsAttemptingToDisconnect = false;

            NetOutgoingMessage hail = Client.CreateMessage();
            hail.Write(playerName);
            Client.Connect(connectTo, hail);
        }
        public override void Start(int rate)
        {
            base.Start(rate);

            window = new GameWindow();
            window.Visible = true;

            Uri shader = new Uri("shader://FileSystemMod/effects/basic30.effect");
            renderer = new GL30BatchVertexRenderer();
            /*
            renderer.ActiveShader = sh;
            renderer.ActiveShader["Proj"] = Matrix4.Identity;
            renderer.ActiveShader["View"] = Matrix4.Identity;
            */
            window.KeyPress += new EventHandler<KeyPressEventArgs>(window_KeyPress);

            int port = 2861;

            Util.Msg("Starting Client");
            NetPeerConfiguration config = new NetPeerConfiguration(Watertight.ImplName + Watertight.Version);
            config.Port = port + 1;
            config.UseMessageRecycling = true;

            NetClient client = new NetClient(config);
            client.Start();

            NetOutgoingMessage connectMessage = client.CreateMessage();
            ConnectPacket connect = new ConnectPacket();
            connect.Encode(ref connectMessage);

            client.Connect("localhost", port, connectMessage);

            Simulation.LuaComponent lc = Simulation.EntityComponentDictionary.NewComponent("TestLuaComponent") as Simulation.LuaComponent;

            foreach (Mod m in ModManager.Mods())
            {
                m.ResourceLoad();
            }

            RunGameLoop();
        }
示例#22
0
        static void Main(string[] args)
        {
            NetPeerConfiguration config = new NetPeerConfiguration("LidgrenTestServer");
            config.AutoFlushSendQueue = false;
            var s_client = new NetClient(config);

            s_client.Start();
            NetOutgoingMessage hail = s_client.CreateMessage("This is the hail message");
            s_client.Connect("localhost", 14242, hail);

            NetIncomingMessage msg;
            while (true)
            {
                if ((msg = s_client.ReadMessage()) != null)
                {
                    Console.WriteLine(msg.ReadString());
                    s_client.Recycle(msg);
                }
                Thread.Sleep(20);
            }
        }
        public NetworkManager(string Server_ip, int Port, string Name, string Password)
        {
            this.Name = Name;
            this.Password = Password;
            this.Server_ip = Server_ip;
            this.Port = Port;

            //Create client
            NetPeerConfiguration Config = new NetPeerConfiguration("kycklingstuds"); // Create new instance of configs. Parameter is "application Id". It has to be same on client and server.
            Client = new NetClient(Config); // Create new client, with previously created configs
            Client.Start(); // Start client

            //lines commented out bellow will be used later when we have login suport on the server program

            //Create the first message to the server that contains login data
            NetOutgoingMessage outmsg = Client.CreateMessage(); // Create new outgoing message
            outmsg.Write(this.Name);
            outmsg.Write(this.Password);
            Client.Connect(this.Server_ip, this.Port, outmsg); // Connect client, to ip in the properties file

            Incomming = new List<NetIncomingMessage>();
        }
        public void ConnectToServer(string nickname) {
            Log.Print("Hello");
            Log.Print(String.Format("Connecting to the server {0}:{1}", _ip, Settings.Port), LogType.Network);

            var config = new NetPeerConfiguration(Settings.GameIdentifier);

            Client = new NetClient(config);
            Client.RegisterReceivedCallback(GotMessage);

            Client.Start();

            NetOutgoingMessage hail = Client.CreateMessage("Hail message");
            Log.Print("Before connect", LogType.Network);
            Client.Connect(_ip, Settings.Port, hail);

            // TODO: Сделать вразумительное ожидание завершения подключения...
            Thread.Sleep(400);

            Log.Print("NetStatus: " + Client.ConnectionStatus, LogType.Network);
            var nc = new NetCommand(NetCommandType.Connect, nickname);
            Send(nc, NetDeliveryMethod.ReliableOrdered);
        }
        public override Task<bool> ConnectAsync()
        {
            if (State != ChannelStateType.Closed)
                throw new InvalidOperationException("Should be closed to connect.");

            var tcs = _connectTcs = TaskFactory.Create<bool>();
            _logger?.Info("Connect.");

            SetState(ChannelStateType.Connecting);

            _client = new NetClient(_netConfig);
            _client.Start();

            var hail = _client.CreateMessage();
            if (string.IsNullOrEmpty(_token) == false)
                hail.Write(_token);
            _client.Connect(_remoteEndPoint, hail);

            _clientThread = new Thread(ClientThreadWork);
            _clientThread.Start();

            return tcs.Task;
        }
        /// <summary>
        ///     Login server constructor. Starts the Login LidgrenServer, and conects to all the master server.
        /// </summary>
        public LoginServer()
        {
            //TODO: LOGINSERVERCONFIG
            //EVENTUALLY ALL OF THIS WILL BE LOADED FROM FILE
            var config = new NetPeerConfiguration("MobiusLoginServer");
            config.Port = 5055;
            config.MaximumConnections = 1000;
            LidgrenServer = new NetServer(config);

            MasterServerConnections = new List<NetClient>();

            var masterclient = new NetClient(new NetPeerConfiguration("MobiusMasterServer"));
            masterclient.Start();
            NetOutgoingMessage loginconnectmessage = masterclient.CreateMessage();
            loginconnectmessage.Write("lgn");
            loginconnectmessage.Write(Guid.Empty.ToByteArray());
            masterclient.Connect("127.0.0.1", 5056, loginconnectmessage);
            MasterServerConnections.Add(masterclient);
            LidgrenServer.Start();

            idtomasterserver = new Dictionary<Guid, ulong>();

            //DATABASE INITIALIZATION
            idtoconnection = new Dictionary<NetConnection, Guid>();
            idtouser = new Dictionary<Guid, User>();
            usertopasswords = new Dictionary<string, string>();
            usernametoid = new Dictionary<string, Guid>();

            CreateUser("addiem", "helloworld");
            CreateUser("username", "password");
            CreateUser("herpderp", "derpherp");
            CreateUser("Katie", "zoekitty");
            CreateUser("Xuande", "luckycat");
            CreateUser("Mom", "biglake");
            CreateUser("Ian", "dicksdicksdicks");
        }
示例#27
0
文件: PNet.cs 项目: seisenhut/PNet
        /// <summary>
        /// Connect to the specified ip on the specified port
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <param name="bindport">port to actually listen on. Default is just the first available port</param>
        public static void Connect(string ip, int port, int bindport = 0)
        {
            if (peer != null && peer.Status != NetPeerStatus.NotRunning)
            {
                Debug.LogError("cannot connect while connected");
                return;
            }

            //do we have an engine hook?
            if (!singletonEngineHook)
            {
                var gobj = new GameObject("UNet Singleton");
                singletonEngineHook = gobj.AddComponent<EngineUpdateHook>();
                GameObject.DontDestroyOnLoad(gobj);
                gobj.hideFlags = HideFlags.HideAndDontSave;

            }
            //set up netclient...

            ResourceCache = new Dictionary<string, GameObject>();

            singletonEngineHook.UpdateSubscription += Update;

            config = new NetPeerConfiguration("PNet");
            config.Port = bindport; //so we can run client and server on the same machine..

            peer = new NetClient(config);

            peer.Start();

            var hailMessage = peer.CreateMessage();
            WriteHailMessage(hailMessage);
            peer.Connect(ip, port, hailMessage);
        }
示例#28
0
        private void setupNetworking()
        {
            NetPeerConfiguration config = new NetPeerConfiguration("SkySlider");
            config.EnableMessageType(NetIncomingMessageType.Data);
            client = new NetClient(config);
            client.Start();
            client.Connect("156.143.93.190", 16645);

            NetOutgoingMessage newClientMsg = client.CreateMessage();
            newClientMsg.Write((byte)ClientToServerProtocol.NewConnection);
            newClientMsg.Write(localPlayerName);
            Thread.Sleep(500);

            client.SendMessage(newClientMsg, NetDeliveryMethod.ReliableOrdered);

            Thread thread = new Thread(new ThreadStart(listenForPackets));
            thread.Start();
        }
        /// <summary>
        ///     Sends this instance of a packet to the server.
        /// </summary>
        /// <param name="client">
        ///     The server to send the packet to.
        /// </param>
        public override void Send(NetClient client)
        {
            // Create a new message
            var msg = client.CreateMessage();

            // Write header
            msg.Write(this.Header);

            // Write target
            msg.Write(this.targetNetworkId);

            // Write plugin data
            msg.Write(this.Message.Data);

            // Manually encrypt message
            msg.Encrypt(Live.EncryptionAlgorithm);

            // Send Packet
            client.SendMessage(msg, NetDeliveryMethod.Unreliable);
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var configLogin = new NetPeerConfiguration("Login");
            configLogin.EnableMessageType(NetIncomingMessageType.UnconnectedData);
            configLogin.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess);
            login = new NetClient(configLogin);
            login.RegisterReceivedCallback(new SendOrPostCallback(GotMessage));
            login.Start();

            var config = new NetPeerConfiguration("ChatLobby");
            config.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess);
            client = new NetClient(config);
            client.RegisterReceivedCallback(new SendOrPostCallback(GotMessage));
            client.Start();

            NetOutgoingMessage listRequest = login.CreateMessage();
            listRequest.Write((byte)NetDataType.eDATA_REQUEST_SERVER_LIST);
            login.SendUnconnectedMessage(listRequest, m_masterServer);
        }
示例#31
0
        static void Main(string[] args)
        {
            // Ask for IP
            Console.WriteLine("Enter IP To Connect");

            // Read Ip to string
            string hostip = Console.ReadLine();

            // Create new instance of configs. Parameter is "application Id". It has to be same on client and server.
            NetPeerConfiguration Config = new NetPeerConfiguration("game");

            // Create new client, with previously created configs
            Client = new NetClient(Config);

            // Create new outgoing message
            NetOutgoingMessage outmsg = Client.CreateMessage();

            //LoginPacket lp = new LoginPacket("Katu");

            // Start client
            Client.Start();

            // Write byte ( first byte informs server about the message type ) ( This way we know, what kind of variables to read )
            outmsg.Write((byte)PacketTypes.LOGIN);

            // Write String "Name" . Not used, but just showing how to do it
            outmsg.Write("MyName");

            // Connect client, to ip previously requested from user
            Client.Connect(hostip, 14242,outmsg);

            Console.WriteLine("Client Started");

            // Create the list of characters
            GameStateList = new List<Character>();

            // Set timer to tick every 50ms
            update = new System.Timers.Timer(50);

            // When time has elapsed ( 50ms in this case ), call "update_Elapsed" funtion
            update.Elapsed += new System.Timers.ElapsedEventHandler(update_Elapsed);

            // Funtion that waits for connection approval info from server
            WaitForStartingInfo();

            // Start the timer
            update.Start();

            // While..running
            while (IsRunning)
            {
                // Just loop this like madman
                GetInputAndSendItToServer();

            }
        }