public void start() { try { baseSock = new TcpClient(ip, port); } catch (System.Net.Sockets.SocketException e) { MessageBox.Show("Error connecting: " + e.Message); return; } started = true; baseStream = baseSock.GetStream(); socket = new Wrapped.Wrapped(baseStream); myform.puts("Connected to minecraft server."); Handshake handshake = new Handshake(socket, myform, true); // Begin handling packets (Seperate thread to prevent bottlenecks) Thread handle = new Thread(handlePackets); handle.Start(); handler = handle; }
static void Main(string[] args) { //try //{ TcpClient client = new TcpClient("mod.esisca.kr", 38571); Wrapped.Wrapped wrapped = new Wrapped.Wrapped(client.GetStream()); wrapped.writeByte(254); wrapped.writeByte(1); if (wrapped.readByte() == 255) { string mystring = wrapped.readString(); string[] mysplit = mystring.Split(((char)(((byte)(0))))); Console.WriteLine("서버오픈"); } //} //catch //{ // Console.ReadLine(); //} }