예제 #1
0
        // Use this for initialization
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting...");
            var client = new TcpClient(serverName, serverPort);

            Console.WriteLine(string.Format("Client connected: {0}", client.Connected));
            var stream = client.GetStream();

            while (true)
            {
                Console.WriteLine("Writing to stream...");
                var msg = EncodeMessage.PlayerEnteredSystem();
                msg.WriteTo(stream);
                stream.Flush();
                var response = BsonDocument.ReadFrom(stream);
                Console.WriteLine("Received {0}", response);
                Thread.Sleep(100);
            }
        }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        var ug = new UniverseGen();
        var p  = ug.MakeRandomStarSystem(0);

        Debug.Log(p);
        var client = new TcpClient(serverName, serverPort);

        Debug.Log(string.Format("Client connected: {0}", client.Connected));
        var stream = client.GetStream();

        Debug.Log("Grawr!");
        var wossname = BsonDocument.ReadFrom(stream);
        var pl       = DecodeMessage.Place(wossname);

        Debug.Log(pl);

        var msg = EncodeMessage.PlayerEnteredSystem();

        msg.WriteTo(stream);
        //var place = DecodeMessage.Place(wossname);
        //Debug.Log (place.ToString());
    }