6 #define MONITORINGPORT 9930
20 #include <sys/types.h>
27 #include <netinet/in.h>
28 #include <sys/types.h>
29 #include <sys/socket.h>
41 if (_sockfd) close (_sockfd);
42 if (bp != NULL )
delete [] bp;
43 if (bptr != NULL )
delete bptr;
49 string host =
"localhost";
51 if ( getenv(
"RCDAQHOST") )
53 host = getenv(
"RCDAQHOST");
77 struct hostent *p_host;
78 p_host = gethostbyname(ip);
95 _theIP = p_host->h_name;
101 server.sin_family = AF_INET;
102 bcopy(p_host->h_addr, &(
server.sin_addr.s_addr), p_host->h_length);
111 if ( _defunct ) os <<
" *** defunct";
118 static char line[180];
119 strcpy (line,
" -- rcdaqEventiterator reading from ");
120 strcat (line, _theIP.c_str());
130 if ( _defunct )
return 0;
134 if (last_read_status)
return NULL;
139 if ( (last_read_status = read_next_buffer()) !=0 )
145 while (last_read_status == 0)
147 if (bptr) evt = bptr->getEvent();
150 last_read_status = read_next_buffer();
169 _sockfd = socket(AF_INET, SOCK_STREAM, 0);
170 if ( _sockfd < 0)
return 0;
172 if ( connect(_sockfd, (
struct sockaddr*) &
server,
sizeof(
server)) < 0 )
181 int flag = htonl(64*1024*1024);
192 status =
readn (_sockfd, (
char *) &sizetobesent, 4);
207 allocatedsize = i * 2048;
208 bp =
new PHDWORD[allocatedsize];
215 bp =
new PHDWORD[allocatedsize];
226 int ackvalue = htonl(101);
227 writen (_sockfd,(
char *) &ackvalue, 4);
240 nread = recv (fd, ptr, nleft, MSG_NOSIGNAL);
250 return (nbytes-nleft);
260 nwritten = send (fd, ptr, nleft, MSG_NOSIGNAL);
268 return (nbytes-nleft);