HP A180 HP DLPI Programmer's Guide - Page 213
data_area[0], printfreceived %d bytes, first word = %d\n, recv_len
View all HP A180 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 213 highlights
Sample Programs Connectionless Mode Example for(i = 0; i < 5; i++) { /* send (i+1)*10 data bytes with the first byte = i */ data_area[0] = i; /* Initialize data area */ for (j = 1; j < (i+1)*10; j++) data_area[j] = "a"; print_dlsap("sending data to ",rdlsap, rdlsap_len); send_data(send_fd, rdlsap, rdlsap_len, (i + 1) * 10); /* receive the data packet */ recv_len = recv_data(recv_fd); printf("received %d bytes, first word = %d\n", recv_len, data_area[0]); } /* We're finished. Now call cleanup to unbind, then detach, then close the device file. */ cleanup(send_fd); cleanup(recv_fd); } Appendix A 213
Sample Programs
Connectionless Mode Example
Appendix A
213
for(i = 0; i < 5; i++) {
/* send (i+1)*10 data bytes with the first byte = i */
data_area[0] = i;
/* Initialize data area */
for (j = 1; j < (i+1)*10; j++)
data_area[j] = "a";
print_dlsap("sending data to ",rdlsap, rdlsap_len);
send_data(send_fd, rdlsap, rdlsap_len, (i + 1) * 10);
/* receive the data packet */
recv_len = recv_data(recv_fd);
printf("received %d bytes, first word = %d\n", recv_len,
data_area[0]);
}
/*
We’re finished.
Now call cleanup to unbind, then detach,
then close the device file.
*/
cleanup(send_fd);
cleanup(recv_fd);
}