Current location: Java technology homepage> network communication> conversion: a simple example of 8583 messages |
Conversion: a simple example of 8583 packets 8583. Let me give a simple example. Let's take the reports from 64 domains as an example. I can't tell what the domain is. You can think of it as a hospital drawer for medicine. A drawer predefines what to put, for example, Viagra, or cold granules, it is generally recommended that you always put Viagra in the drawer of Viagra, and do not put anything else. Of course, you can also put the blue root, but this is easy to make mistakes, not standard. The quantity is specified in three cases: The first is quantitative. That is to say, if we have defined 30 bottles of Viagra in this drawer, we can put 30 bottles and one bottle, but not less. The second is llvar, that is to say, the number is defined by 1 byte. For example, 0x12 indicates that 12 bottles are put in it. Of course, you can also consider 16 + 2 = 18 bottles. But if 0x12 represents 12, then 0x13 is equal to 13, instead of 0x12 = 12, 0x13 = 19 The last is lllvar, which is a two-byte number, for example, 0x01,0x04 = 104. The domain is like this. There are 64 domain names, and each domain predefines the content and length. There is a bitmap, that is, a bitmap, which defines a packet containing Several domains. For example 20 00 38 00 00 00 00 34 You can unlock it and arrange it. 20 = 0010 0000 00 = 0000 0000 38 = 0011 1000 And so on to obtain a string of numbers. 0010 0000 0000 0000 0011 1000 0000 0000 0000 0000 0000 0000 0000 0000 0011 0100 Then, the numbers from left to right contain 1 digits. In the above example, we get 3 19 20 21 59 60 62, these digits contain 1. That is to say, the next packet contains these domains. Let's take a simple example, for example, consumption transaction, sending transaction type, card number, and so on. The definitions are as follows: Card number 2nd domain llvar BCD 5309987876545342 Transaction type 3rd domain length 6 BCD 900000 Amount 4th domain length 12 BCD 100 points Time 7th domain length 8 BCD 20030802 2. Track information 35th domain llvar ASCII 123456 3. Magnetic track information 36th domain lllvar BCD 123456001 Merchant ID 41st domain llvar ASCII 98765432 Now let's start packaging. First, process the above data according to the length and type. Card No. 165309987876545342 Transaction type 900000 Amount 000000000100 Time 20030802 2 channels 06313233343536 3 channels 0009123456001 Merchant ID 083938373635343332 Next we will generate bitmap based on the domain information Because there are 2nd domains, the second location is 1, from the third domain, so the third location Is 1 ,... In this case, a string of numbers is obtained. 0111 0010 0000 0000 0000 0000 0000 0000 0011 0000 1000 0000 0000 0000 0000 0000 The conversion is 72 00 00 00 30 80 00 00 00. This is bitmap. Then, sort the above data according to the content of Bitmap + each domain in sequence. The contents of this package are displayed. 7200000030800000165309987876545342900000000000000100 20030802063132333435360009123456001083938373635343332 Tpdu and msgid are the final data packets. It's easy to get rid of the package. Address: http://www.cnpoint.com/framwwork/2007/0103/content_4825.htm Source: Web Development Resources Alliance (http://www.cnpoint.com /) Author: Point A simple example of a 8583 packet (http://www.cnpoint.com/framwwork/2007/0103/content_4825.htm) |