static void Main6() { byte[] inputData = new byte[] { 0x20, 0x00, //KeyNo(1 Byte) + KeyVer(1 Byte) 0x04, 0x87, 0x3A, 0xBA, 0x8D, 0x2C, 0x80,//UID(7 Bytes) 0x4E, 0xF6, 0x10, 0x41, 0xAB, 0xE8, 0xB0, 0xEF, 0x8B, 0x32, 0xA6, 0x27, 0xB1, 0x9D, 0x83, 0xAA//E(RanB) (16 bytes) }; string keyLabel = "2ICH3F0000" + inputData[0].ToString() + "A"; //byte[0] string KeyVersion = inputData[1].ToString(); //byte[1] string uid = BitConverter.ToString(inputData, 2, 7).Replace("-",""); //byte[2~8] string enc_RanB = BitConverter.ToString(inputData, 9, 16).Replace("-", ""); //byte[9~24] //========================= string uri = "http://10.27.88.164:1539/AutoloadHandler.ashx"; //@"http://10.27.88.164:1538/AuthHandler.ashx"; IHttpClient_Simple test = new HttpClient_Simple(3000, uri); string data = "32" + "00" + "04873ABA8D2C80" + "4EF61041ABE8B0EF8B32A627B19D83AA"; byte[] dataBytes = Encoding.ASCII.GetBytes(data); //***************************************************** //回傳Byte Array byte[] result = test.Post(dataBytes); Console.WriteLine("回傳資料(hex):\n" + BitConverter.ToString(result).Replace("-", "")); //Console.WriteLine("回傳資料(Encoding):" + Encoding.ASCII.GetString(result)); //***************************************************** //回傳傳String string result2 = test.Post(data); Console.WriteLine("回傳資料2(hex):\n" + result2); Console.ReadKey(); }
//測試異常 => 回傳 ha ha static void Main4() { string uri = @"http://10.27.88.164:1538/AuthHandler.ashx"; IHttpClient_Simple test = new HttpClient_Simple(3000, uri); byte[] data = test.Post(new byte[2],uri); Console.WriteLine("回傳資料(hex):" + BitConverter.ToString(data).Replace("-","")); Console.WriteLine("回傳資料(Encoding):" + Encoding.ASCII.GetString(data)); Console.ReadKey(); }