All pastes #16182 Raw Edit

Stuff

public text v1 · immutable
#16182 ·published 2005-06-28 22:21 UTC
rendered paste body
  while (!ifstr.eof())  {
    getline(ifstr, buf);
    buf+="\r\n";


    while(retval != 0) {

      retval = select(sockfd+1, &rfds, NULL, NULL, &tv);
      if (retval != 0){
	cout << "recvar" << endl;
	recvBytes = recv (sockfd, SITE, MAXDATASIZE-1, 0);
	cout << "Recieved: " << SITE << flush;
	cout << strlen(SITE) << endl;
	cout << "recvBytes=" << recvBytes << "\nretval=" << retval << endl;
	SITE[0]='\0';
      }
      else if (retval == -1){
	cout << strerror(errno) << endl;
	close(sockfd);
	exit(EXIT_FAILURE);
      }
      FD_SET(sockfd, &rfds);
      FD_ZERO(&rfds); 
    } //while

Output:
Connected..
recvar
Recieved: 220 obelix.northernmost.org ESMTP Sendmail 8.13.1/8.13.1; Wed, 29 Jun 2005 00:20:44 +0200
strlen(SITE)=91
recvBytes=91
retval=1
Sending: QUIT
recvar
Recieved: 221 2.0.0 obelix.northernmost.org closing connection
.1; Wed, 29 Jun 2005 00:20:44 +0200
strlen(SITE)=91
recvBytes=54
retval=1