Toshiba T2N Network Card User Manual


 
56
6 F 3 B 0 3 6 2
/* Set the data count. */
idat = DATASIZ ; /* Register read data length. */
sprintf( &csnd[ strlen( csnd ) ], "%02d", idat ) ;
sprintf( &csnd[ strlen( csnd )], ")¥r" ) ;
isndsiz = strlen(csnd) ;/* Set up the data transmission length.
*/
/* Send the register read command.
*/
ists = sendto( Isdp, csnd, isndsiz, 0,
(struct sockaddr *)&Snd,sizeof( Snd ) );
if( ists == isndsiz ){
/* Set the BIT initial value. */
memset(&ibits,0x00,sizeof(fd_set));
timeout.tv_sec = RECVTOUT; /* Set the timeout time. */
/* BIT setup */
FD_SET(Isdp,&ibits);
ists = select( 1, &ibits,0,0,
(struct timeval *)&timeout);
if(ists <= 0){ /* If timeout and error: */
return( -1 ) ; /* recvfrom timed out. */
}
/* Register read response reception */
ists = recvfrom( Isdp, crcv, sizeof( crcv ), 0
,(struct sockaddr *)&Rcv, &ircvsiz) ;
if ( ists > 5 ){
if( crcv[ 6 ] == 'C' && crcv[ 7 ] == 'E' ){
iret = -1 ; /* Register read response error */
}
else{ /* Register read response was normal. */
iret = 0 ;
}
}
}
}
}
}
return( iret ) ;
}