I have got the following packet format to be send to machine:-
byte byte byte byte
2 2 1 1
+---------+-------+-------------+----------+
| CM | 00 | check sum | CR |
+---------+-------+-------------+----------+
I have the following instructions:-
All data isASCII character code without checksumand CR.
Calculate sum total from top till before checksum ( 1 bite unit ),then recognize this complement of 1 as checksum.
Finish of format is CR (Hexadecimal: OD)
I implemented the check sum algo given on the following link
http://tools.ietf.org/rfc/rfc1071.txt[
^]
I have to send the above packet to the Dialysis machine.
Can anyone tell me the Algorithm which is mostly used in Hardware machines.
Is there any check sum calculator from which i can directly calculate check sum and send the hard coded check sum value to the machine as my contents of packet are fixed.
[edit from OP]
i did like this have a look:-
char data[6]="CM00";
data[4]=0xF0;
data[5]=0x0D;
iResult = send( ConnectSocket, data, (int)strlen(data), 0 );
if (iResult == SOCKET_ERROR) {
printf("send failed with error: %d\n", WSAGetLastError());
closesocket(ConnectSocket);
WSACleanup();
return 1;
}
printf("Bytes Sent: %ld\n", iResult);
i get a display bytes sent 6
but still not getting the response please help
[/edit]