src/connect.c
int recv_from_twitserver( int sockfd, int timeunit ){
	int status = 0;
	ssize_t nbytes;	
	char ch;

	assert( timeunit >= 0 );

	while( 1 ){
		errno = 0;
		sleep( timeunit );
		nbytes = read( sockfd, &ch, sizeof( ch ) );
		if ( nbytes == -1 ){
			if ( errno == EINTR ){
				continue;
			}
			error( "could not receive byte from twit server: (%s)\n", strerror( errno ) );
			status = -1;
			break;
		}
		errno = 0;
		if ( fprintf( stdout, "%c", ch ) == -1 ){
			error( "could not send byte to stdout: (%s)\n", strerror( errno ) );
			status = -1;
			break;
		}
		( void )fflush( stdout );
	}

	return ( status );
}
// Start receiving twits from the twitserver. Return 0 if ok and -1 otherwise.
Start receiving twits from the twitserver. Return 0 if ok and -1 otherwise.
Start receiving twits from the twitserver . Return 0 if ok and - 1 otherwise .
int recv_from_twitserver( int sockfd, int timeunit ){
	int status = 0;
	ssize_t nbytes;	
	char ch;
	assert( timeunit >= 0 );
	while( 1 ){
		errno = 0;
		sleep( timeunit );
		nbytes = read( sockfd, &ch, sizeof( ch ) );
		if ( nbytes == -1 ){
			if ( errno == EINTR ){
				continue;
			}
			error( "could not receive byte from twit server: (%s)\n", strerror( errno ) );
			status = -1;
			break;
		}
		errno = 0;
		if ( fprintf( stdout, "%c", ch ) == -1 ){
			error( "could not send byte to stdout: (%s)\n", strerror( errno ) );
			status = -1;
			break;
		}
		( void )fflush( stdout );
	}
	return ( status );
}
int recv_from_twitserver ( int sockfd , int timeunit ) { int status = 0 ; ssize_t nbytes ; char ch ; assert ( timeunit >= 0 ) ; while ( 1 ) { errno = 0 ; sleep ( timeunit ) ; nbytes = read ( sockfd , & ch , sizeof ( ch ) ) ; if ( nbytes == -1 ) { if ( errno == EINTR ) { continue ; } error ( " \n " , strerror ( errno ) ) ; status = -1 ; break ; } errno = 0 ; if ( fprintf ( stdout , " " , ch ) == -1 ) { error ( " \n " , strerror ( errno ) ) ; status = -1 ; break ; } ( void ) fflush ( stdout ) ; } return ( status ) ; }
Start receiving twits from the twitserver.
Start receiving twits from the twitserver .