Пример #1
0
        //<summary>
        // Invokes a method using the Object List that was returned from conversion
        //</summary>
        private static void InvokeMessage(List <object> sentMessage)
        {
            String MethodName = (string)sentMessage [0];

            sentMessage.RemoveAt(0);

            AltimitMethod.CallAltimitMethod(MethodName, sentMessage.ToArray());
        }
Пример #2
0
        //<summary>
        // Connect to an Altimit Server at a specified ip and port
        //</summary>
        public static void Connect(String ip, int port)
        {
            Thread.Sleep(1000);

            AltimitMethod.CompileAltimitMethods();

            try{
                IPHostEntry ipHostInfo = Dns.GetHostEntry(ip);

                IPAddress ipAddress = null;

                foreach (IPAddress addr in ipHostInfo.AddressList)
                {
                    IPAddress address;
                    if (IPAddress.TryParse(addr.ToString(), out address))
                    {
                        switch (address.AddressFamily)
                        {
                        case System.Net.Sockets.AddressFamily.InterNetwork:
                            ipAddress = addr;
                            break;

                        default:
                            // umm... yeah... I'm going to need to take your red packet and...
                            break;
                        }
                    }
                }

                IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);

                Thread.Sleep(1000);

                Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallBack), client);
            } catch (Exception e) {
                Debug.LogError(e.ToString());
            }
        }