iso_8583 message
-
There is only one reference page which is reliable when it is about ISO, and this is ISO.org. Have a look at the standard as it is scripted there[^] and you will find the answer by yourself.
cheers Marco Bertschi
Software Developer Twitter | Facebook | Articles
You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff
I have sent the packet through tcp socket. when i was analyzing the packet through wireshark i was getting the packet in the server side like below : 2E 60 01 23 06 08 20 20 01 c0 00 .5 .#.... ..... 92 12 01 23 48 30 30 30 30 30 30 ...#H000009 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005 while my actual packet is 00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 .5 .#.... ..... 00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 ........#H000009 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005 Why all 00 bytes are not getting sent..Can anybody tell me. Please Help !!!!!
-
There is only one reference page which is reliable when it is about ISO, and this is ISO.org. Have a look at the standard as it is scripted there[^] and you will find the answer by yourself.
cheers Marco Bertschi
Software Developer Twitter | Facebook | Articles
You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff
The code which i am Using for creating the Packet is
#include
#include
#include
#include
#include
#includechar cHexDigit_to_Nibble1(unsigned char c)
{//if((!isxdigit(c)) || (c != 0x3D)) if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); // adjust hexadecimal 'A' to 0x0A return (c - 55);
}
void vAscii2BCD(unsigned char *pucSrc, unsigned char *pucDst, int inSize)
{for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; \*pucDst = '='; } else { \*pucDst = cHexDigit\_to\_Nibble1(\*pucSrc++) << 4; \*pucDst |= cHexDigit\_to\_Nibble1(\*pucSrc++); } } printf("data is %s\\n\\n",pucDst);
}
int main()
{
int sock_desc, status;
struct sockaddr_in client;
struct addrinfo hints;
WSADATA Data;int bytesSent; int bytesRecv = SOCKET\_ERROR; //char sendbuf\[32\] = "Client: Sending data."; //char sendbuf\[\] = "002F600123060008002020010000c0000092000000001201234830303030303039533130303030303030303030303035"; //char sendbuf\[\] = "002F600123060008002020010000c000009200000000120123H0000009S10000000000005"; //char sendbuf\[\] = "0111011110000000010000110110100000110010010101110111000000110010100000001001011000010011011101000101010101110011000010001000000000000000000101000110000000000000000000011000000100110101H0000009S10000000000005"; char recvbuf\[256\] = ""; unsigned char \*pucSrc = (unsigned char\*) malloc (100) ; unsigned char \*pucDst = (unsigned char\*) malloc (256) ; //unsigned char \*Output\_Buff = (unsigned char\*) malloc (20) ; int inSize = 12 ; //memset(Output\_Buff,0,20) ; memset(pucSrc,0,256); memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"00" ,pucDst, 1) ;// strcpy((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"2E" ,pucDst, 1) ;// //vAscii2BCD((unsigned char\*)"002E" ,pucDst, 4) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"60012306 " ,pucDst, 12) ;// vAscii2BCD((unsigned char\*)"6001230600" ,pucDst, 5) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)" 8 " ,pucDst, 4) ;//48564848 vAscii2BCD((unsigned char\*)"0800" ,pucDst, 2) ;//48564848 strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C0
-
I have sent the packet through tcp socket. when i was analyzing the packet through wireshark i was getting the packet in the server side like below : 2E 60 01 23 06 08 20 20 01 c0 00 .5 .#.... ..... 92 12 01 23 48 30 30 30 30 30 30 ...#H000009 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005 while my actual packet is 00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 .5 .#.... ..... 00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 ........#H000009 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005 Why all 00 bytes are not getting sent..Can anybody tell me. Please Help !!!!!
Once again, read the ISO standard carefully, it is explained nicely there. And you might want to learn about sockets, or post the problem with the socket separately.
cheers Marco Bertschi
Software Developer Twitter | Facebook | Articles
You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff
-
The code which i am Using for creating the Packet is
#include
#include
#include
#include
#include
#includechar cHexDigit_to_Nibble1(unsigned char c)
{//if((!isxdigit(c)) || (c != 0x3D)) if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); // adjust hexadecimal 'A' to 0x0A return (c - 55);
}
void vAscii2BCD(unsigned char *pucSrc, unsigned char *pucDst, int inSize)
{for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; \*pucDst = '='; } else { \*pucDst = cHexDigit\_to\_Nibble1(\*pucSrc++) << 4; \*pucDst |= cHexDigit\_to\_Nibble1(\*pucSrc++); } } printf("data is %s\\n\\n",pucDst);
}
int main()
{
int sock_desc, status;
struct sockaddr_in client;
struct addrinfo hints;
WSADATA Data;int bytesSent; int bytesRecv = SOCKET\_ERROR; //char sendbuf\[32\] = "Client: Sending data."; //char sendbuf\[\] = "002F600123060008002020010000c0000092000000001201234830303030303039533130303030303030303030303035"; //char sendbuf\[\] = "002F600123060008002020010000c000009200000000120123H0000009S10000000000005"; //char sendbuf\[\] = "0111011110000000010000110110100000110010010101110111000000110010100000001001011000010011011101000101010101110011000010001000000000000000000101000110000000000000000000011000000100110101H0000009S10000000000005"; char recvbuf\[256\] = ""; unsigned char \*pucSrc = (unsigned char\*) malloc (100) ; unsigned char \*pucDst = (unsigned char\*) malloc (256) ; //unsigned char \*Output\_Buff = (unsigned char\*) malloc (20) ; int inSize = 12 ; //memset(Output\_Buff,0,20) ; memset(pucSrc,0,256); memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"00" ,pucDst, 1) ;// strcpy((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"2E" ,pucDst, 1) ;// //vAscii2BCD((unsigned char\*)"002E" ,pucDst, 4) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"60012306 " ,pucDst, 12) ;// vAscii2BCD((unsigned char\*)"6001230600" ,pucDst, 5) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)" 8 " ,pucDst, 4) ;//48564848 vAscii2BCD((unsigned char\*)"0800" ,pucDst, 2) ;//48564848 strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C0
-
Pleas edit this entry and remove the blockquote surrounding the code and replace with <pre> tags, so your code is readable.
Use the best guess
Please check #include #include #include #include #include #include void Print_Debug(char *str) { printf("%s", str); ///change this prtES with your print API. } void Print_HexDump(char *Title, unsigned char * ucBuf, unsigned int uiSize) { unsigned int uiLoop; unsigned int uiChars = 0; char buffer[100]; if(uiSize == 0) return; Print_Debug(Title); memset(buffer, 0, 40); memset(buffer, '-', 39); Print_Debug(buffer); memset(buffer, ' ', 39); for (uiLoop = 0; uiLoop < uiSize; uiLoop++) { sprintf(&buffer[(uiChars * 3)], "%02X", ucBuf[uiLoop]); buffer[2 + (uiChars * 3)] = ' '; buffer[30 + uiChars] = ((ucBuf[uiLoop] > 32) && (ucBuf[uiLoop] < 125)) ? ucBuf[uiLoop] : '.'; uiChars++; if((uiChars == 10) || ((uiLoop + 1) == uiSize)) { buffer[29] = '|'; // column separater buffer[30 + uiChars] = 0; // null terminate string Print_Debug(buffer); memset(buffer, ' ', 40); uiChars = 0; } } memset(buffer, '-', 39); Print_Debug(buffer); } char cHexDigit_to_Nibble1(unsigned char c) { //if((!isxdigit(c)) || (c != 0x3D)) if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); // adjust hexadecimal 'A' to 0x0A return (c - 55); } void vAscii2BCD(unsigned char *pucSrc, unsigned char *pucDst, int inSize) { for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; *pucDst = '='; } else { *pucDst = cHexDigit_to_Nibble1(*pucSrc++) << 4; *pucDst |= cHexDigit_to_Nibble1(*pucSrc++); } } printf("data is %s\n\n",pucDst); } //////////////////////////////////NUMERIC TO BCD///////////////////////////////// void numerictoBCD() { unsigned int uiValue = 920000; unsigned int uiResult = 0; while (uiValue > 0) { uiResult <<= 4; uiResult |= uiValue % 10; uiValue /= 10; } } unsigned long toPackedBcd (unsigned int val) { unsigned long bcdresult = 0; char i; for (i = 0; val; i++) { ((char*)&bcdresult)[i / 2] |= i & 1 ? (val % 10) << 4 : (val % 10) & 0xf; val /= 10; } return bcdresult; } int main() { int sock_desc, status; struct sockaddr_in client; struct addrinfo hints; WSADATA Data; int bytesSent; int bytesRecv = SOCKET_ERROR; //char sendbuf[32] = "Client: Sending data."; //char sendbuf[] = "002F600123060008002020010000c0000092000000001201234830303030303039533130303030303030303030303035"; //char sendbuf[] = "002F600123060008002020010000c000009200000000120123H0000009S10000000000
-
Please check #include #include #include #include #include #include void Print_Debug(char *str) { printf("%s", str); ///change this prtES with your print API. } void Print_HexDump(char *Title, unsigned char * ucBuf, unsigned int uiSize) { unsigned int uiLoop; unsigned int uiChars = 0; char buffer[100]; if(uiSize == 0) return; Print_Debug(Title); memset(buffer, 0, 40); memset(buffer, '-', 39); Print_Debug(buffer); memset(buffer, ' ', 39); for (uiLoop = 0; uiLoop < uiSize; uiLoop++) { sprintf(&buffer[(uiChars * 3)], "%02X", ucBuf[uiLoop]); buffer[2 + (uiChars * 3)] = ' '; buffer[30 + uiChars] = ((ucBuf[uiLoop] > 32) && (ucBuf[uiLoop] < 125)) ? ucBuf[uiLoop] : '.'; uiChars++; if((uiChars == 10) || ((uiLoop + 1) == uiSize)) { buffer[29] = '|'; // column separater buffer[30 + uiChars] = 0; // null terminate string Print_Debug(buffer); memset(buffer, ' ', 40); uiChars = 0; } } memset(buffer, '-', 39); Print_Debug(buffer); } char cHexDigit_to_Nibble1(unsigned char c) { //if((!isxdigit(c)) || (c != 0x3D)) if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); // adjust hexadecimal 'A' to 0x0A return (c - 55); } void vAscii2BCD(unsigned char *pucSrc, unsigned char *pucDst, int inSize) { for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; *pucDst = '='; } else { *pucDst = cHexDigit_to_Nibble1(*pucSrc++) << 4; *pucDst |= cHexDigit_to_Nibble1(*pucSrc++); } } printf("data is %s\n\n",pucDst); } //////////////////////////////////NUMERIC TO BCD///////////////////////////////// void numerictoBCD() { unsigned int uiValue = 920000; unsigned int uiResult = 0; while (uiValue > 0) { uiResult <<= 4; uiResult |= uiValue % 10; uiValue /= 10; } } unsigned long toPackedBcd (unsigned int val) { unsigned long bcdresult = 0; char i; for (i = 0; val; i++) { ((char*)&bcdresult)[i / 2] |= i & 1 ? (val % 10) << 4 : (val % 10) & 0xf; val /= 10; } return bcdresult; } int main() { int sock_desc, status; struct sockaddr_in client; struct addrinfo hints; WSADATA Data; int bytesSent; int bytesRecv = SOCKET_ERROR; //char sendbuf[32] = "Client: Sending data."; //char sendbuf[] = "002F600123060008002020010000c0000092000000001201234830303030303039533130303030303030303030303035"; //char sendbuf[] = "002F600123060008002020010000c000009200000000120123H0000009S10000000000
-
1. I guess you did not understand what "please edit the above entry" means. 2. Check what?
Use the best guess
Hello Sir, I really did not understand what "please edit the above entry" means. Can you pls tell me.. Do I need to edit something in the code or is this not the write way to post the code? Thanks
-
Hello Sir, I really did not understand what "please edit the above entry" means. Can you pls tell me.. Do I need to edit something in the code or is this not the write way to post the code? Thanks
He kindly asked you to edit your existing post (there is a button to do so) and format the source code so that it is readable. To do so, select the code section and click the 'code' button above the editor window or place a <pre> tag at the begin of the code and a </pre> at the end (when clicking the 'code' button this is done automatically). In all cases, check the preview window below the editor window. In the editor window it should look like this:
<pre lang="c++"> // A comment #include <stdio.h> int main() { return 0; }</pre>
Then the preview (and the final post) will look like this:
// A comment
#include <stdio.h>int main()
{
return 0;
} -
Pleas edit this entry and remove the blockquote surrounding the code and replace with <pre> tags, so your code is readable.
Use the best guess
I am using the below code for packing the data in iso 8583 format 00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35
#include #include #include #include #include #include char cHexDigit\_to\_Nibble1(unsigned char c) { if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); return (c - 55); } void vAscii2BCD(unsigned char \*pucSrc, unsigned char \*pucDst, int inSize) { for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; \*pucDst = '='; } else { \*pucDst = cHexDigit\_to\_Nibble1(\*pucSrc++) << 4; \*pucDst |= cHexDigit\_to\_Nibble1(\*pucSrc++); } } printf("data is %s\\n\\n",pucDst); } int main() { int sock\_desc, status; struct sockaddr\_in client; struct addrinfo hints; WSADATA Data; int bytesSent; int bytesRecv = SOCKET\_ERROR; unsigned char \*pucSrc = (unsigned char\*) malloc (100) ; unsigned char \*pucDst = (unsigned char\*) malloc (256) ; memset(pucSrc,0,256); memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"00" ,pucDst, 1) ;// strcpy((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"2E" ,pucDst, 1) ;// //vAscii2BCD((unsigned char\*)"002E" ,pucDst, 4) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"60012306 " ,pucDst, 12) ;// vAscii2BCD((unsigned char\*)"6001230600" ,pucDst, 5) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)" 8 " ,pucDst, 4) ;//48564848 vAscii2BCD((unsigned char\*)"0800" ,pucDst, 2) ;//48564848 strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C00000" ,pucDst, 16) ; vAscii2BCD((unsigned char\*)"2020010000" ,pucDst, 5) ; strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C00000" ,pucDst, 16) ; vAscii2BCD((unsigned char\*)"C00000" ,pucDst, 3) ; strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"92" ,pucDst, 2) ;//575048484848 vAscii2BCD((unsigned char\*)"920000" ,pucDst, 3) ; strcat((char\*)pucSrc,(char\*)pucDst); //strcat((char\*)pucSrc,"00000000") ; printf("si
-
I am using the below code for packing the data in iso 8583 format 00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35
#include #include #include #include #include #include char cHexDigit\_to\_Nibble1(unsigned char c) { if(!isxdigit(c)) return (0); if(isdigit(c)) return (c - '0'); c = toupper(c); return (c - 55); } void vAscii2BCD(unsigned char \*pucSrc, unsigned char \*pucDst, int inSize) { for (; inSize > 0; inSize -= 2, pucDst++) { if(!memcmp(pucSrc, "3D", 2)) { pucSrc += 2; \*pucDst = '='; } else { \*pucDst = cHexDigit\_to\_Nibble1(\*pucSrc++) << 4; \*pucDst |= cHexDigit\_to\_Nibble1(\*pucSrc++); } } printf("data is %s\\n\\n",pucDst); } int main() { int sock\_desc, status; struct sockaddr\_in client; struct addrinfo hints; WSADATA Data; int bytesSent; int bytesRecv = SOCKET\_ERROR; unsigned char \*pucSrc = (unsigned char\*) malloc (100) ; unsigned char \*pucDst = (unsigned char\*) malloc (256) ; memset(pucSrc,0,256); memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"00" ,pucDst, 1) ;// strcpy((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); vAscii2BCD((unsigned char\*)"2E" ,pucDst, 1) ;// //vAscii2BCD((unsigned char\*)"002E" ,pucDst, 4) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"60012306 " ,pucDst, 12) ;// vAscii2BCD((unsigned char\*)"6001230600" ,pucDst, 5) ;// strcat((char\*)pucSrc,(char\*)pucDst) ; memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)" 8 " ,pucDst, 4) ;//48564848 vAscii2BCD((unsigned char\*)"0800" ,pucDst, 2) ;//48564848 strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C00000" ,pucDst, 16) ; vAscii2BCD((unsigned char\*)"2020010000" ,pucDst, 5) ; strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"2020010000C00000" ,pucDst, 16) ; vAscii2BCD((unsigned char\*)"C00000" ,pucDst, 3) ; strcat((char\*)pucSrc,(char\*)pucDst); memset(pucDst,0,256); //vAscii2BCD((unsigned char\*)"92" ,pucDst, 2) ;//575048484848 vAscii2BCD((unsigned char\*)"920000" ,pucDst, 3) ; strcat((char\*)pucSrc,(char\*)pucDst); //strcat((char\*)pucSrc,"00000000") ; printf("si
You are using string functions (
strcpy()
etc.) to copy your data (which are not strings) from one buffer to another, so each copy will stop as soon as it hits a zero character. Usememcpy()
and ensure you copy the exact number of bytes that you wish to transfer.Use the best guess