HP rp5450 HP DLPI Programmer's Guide - Page 199
Fill in data_area with some data to send., fori = 0; i < 60;
View all HP rp5450 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 199 highlights
Sample Programs Connection Mode Example To pass the connection from the control stream to the data stream, we need a token for the data stream. get_token returns this. */ token = get_token(recv_d_fd); /* Now we do a CONNECT_RES on the control stream. The correlation specifies the CONNECT_IND we are responding to, and the token, since it is non-zero, specifies the stream to which we want to hand off the connection. */ connect_res(recv_c_fd, correlation, token); /* Get the CONNECT_CON back on the senders stream */ get_msg(send_fd); check_ctrl(DL_CONNECT_CON); printf("connection established\n"); /* We now have a connection established between the send_fd stream and the recv_d_fd stream. The recv_c_fd stream is in the IDLE state and is ready to process another CONNECT_IND. Since we won't be establishing any new connections, we'll call cleanup on the receiver control stream to unbind, detach, and close the file descriptor. */ cleanup(recv_c_fd); /* Fill in data_area with some data to send. */ for(i = 0; i < 60; i++) { data_area[i] = i; } /* Send 5 packets of data. */ for(i = 0; i < 5; i++) { put_data(send_fd, (i + 1) * 10); printf("sent %d bytes of data\n", (i + 1) * 10); } /* Receive the 5 packets. */ for(i = 0; i < 5; i++) { if(get_msg(recv_d_fd) != GOT_DATA) { printf("error: didn't get data\n"); check_ctrl(0); exit(1); Appendix A 199