1
0
mirror of https://e.coding.net/circlecloud/CTZLauncher.git synced 2024-11-21 01:58:48 +00:00

更新项目...

This commit is contained in:
502647092 2015-10-15 20:51:31 +08:00
parent 4b5d48ae64
commit c998ee5251
2 changed files with 47 additions and 44 deletions

View File

@ -224,6 +224,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="image\area.png" /> <Resource Include="image\area.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="image\join.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,44 +1,44 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MinecraftServerInfo namespace MinecraftServerInfo
{ {
class Program class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
try try
{ {
client.Connect("four.mengcraft.com", 11133); client.Connect("play.i5mc.com", 25565);
Console.WriteLine("开始连接"); Console.WriteLine("开始连接");
if (client.Connected) if (client.Connected)
{ {
Console.WriteLine("发送数据"); Console.WriteLine("发送数据");
client.Send(new byte[] { 0x0F, 0x00, 0x04, 0x09, 0x31, 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x63, 0xDD, 0x01 }); client.Send(new byte[] { 0x0F, 0x00, 0x04, 0x09, 0x31, 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x63, 0xDD, 0x01 });
client.Send(new byte[] { 0x01, 0x00 }); client.Send(new byte[] { 0x01, 0x00 });
Console.WriteLine("读取头数据"); Console.WriteLine("读取头数据");
byte[] header = new byte[5]; byte[] header = new byte[5];
client.Receive(header, header.Length, SocketFlags.None); client.Receive(header, header.Length, SocketFlags.None);
Console.WriteLine(BitConverter.ToString(header)); Console.WriteLine(BitConverter.ToString(header));
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int recover = client.Receive(buffer, buffer.Length, SocketFlags.None); int recover = client.Receive(buffer, buffer.Length, SocketFlags.None);
byte[] data = new byte[recover]; byte[] data = new byte[recover];
Console.WriteLine("数据流长度: " + recover); Console.WriteLine("数据流长度: " + recover);
Array.Copy(buffer, data, recover); Array.Copy(buffer, data, recover);
Console.WriteLine(BitConverter.ToString(data)); Console.WriteLine(BitConverter.ToString(data));
Console.WriteLine(Encoding.UTF8.GetString(data)); Console.WriteLine(Encoding.UTF8.GetString(data));
} }
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message);
} }
Console.ReadLine(); Console.ReadLine();
} }
} }
} }