9 #include <netinet/in.h>
10 #include <sys/socket.h>
12 #if defined(SunOS) || defined(OSF1)
53 char *
t =
new char[strlen(hostport)+1];
54 strcpy ( t, hostport);
56 char *token = strtok(t,
":");
60 token = strtok(0,
":");
84 struct sockaddr_in server_addr;
85 struct hostent *p_host;
88 if ( ! p_host)
return -3;
90 bzero( (
char*) &server_addr,
sizeof(server_addr) );
91 server_addr.sin_family = AF_INET;
92 bcopy(p_host->h_addr, &(server_addr.sin_addr.s_addr), p_host->h_length);
93 server_addr.sin_port = htons(
ThePort);
98 std::cout <<
"error in socket" << std::endl;
105 int s = setsockopt(
sockfd, SOL_SOCKET, SO_SNDBUF,
107 if (s) std::cout <<
"setsockopt status = " << s << std::endl;
110 ,
sizeof(server_addr)) < 0 )
112 std::cout <<
"error in connect" << std::endl;
150 if (!
dirty)
return 0;
155 if ( cstatus )
return cstatus;
162 lzo1x_1_12_compress( (lzo_byte *)
bptr,
165 &outputlength_in_bytes,
wrkmem);
222 nread = read (fd, ptr, nleft);
230 return (nbytes-nleft);
240 nwritten = write (fd, ptr, nleft);
247 return (nbytes-nleft);