public void Connect(string username, string password) { //connect data var mem = new MemoryStream(); BinaryWriter writer = new BinaryWriter(mem); writer.Write((System.Int16) 0); writer.Write(username); writer.Write(password); writer.Flush(); this.connectData = mem.ToArray(); State = STATE_CONNECTING; socket = new NetSocketClientSocket(); socket.connect("127.0.0.1", 8888); this.connectData = mem.ToArray(); }