Alan Knight

Alan Knight

  • NA
  • 5
  • 2k

How to make this work?

Nov 17 2013 1:13 PM
[code]
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace gameloader
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
                TcpClient tcpclnt = new TcpClient();
                // Console.WriteLine("Connecting.....");
                tcpclnt.Connect("192.168.0.192", 9959);
                Stream stm = tcpclnt.GetStream();
                string str = "You got me sucka!!!";
                ASCIIEncoding asen = new ASCIIEncoding();
                byte[] ba = asen.GetBytes(str);
                stm.Write(ba, 0, ba.Length);
                byte[] bb = new byte[100];
                int k = stm.Read(bb, 0, 100);
                for (int i = 0; i < k; i++)
                {
                    Console.Write(Convert.ToChar(bb[i]));

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1());
                    
                }
        }
[/code]

I'm not sure how to make this work? I can have it so the "You get me sucka" shows (as the code is now) but it doesn't run the Form1? I want it so that it sends the message "You got me sucka" to my server and then loads Form1, how do I do this???