40#ifdef G4VIS_BUILD_VRML_DRIVER
47#include <sys/socket.h>
48#include <netinet/in.h>
74 fd = socket(AF_INET, SOCK_STREAM, 0);
76 fputs(
"error: socket.\n", stderr);
82int FRClient::connect(
const char *hostname,
int port_)
85 struct sockaddr_in sa;
90 memset( (
char *)&sa,
'\0',
sizeof(sa)) ;
91 sa.sin_family = AF_INET;
92 sa.sin_port = htons(port);
95 if (hostname == NULL) {
96 hostname =
"localhost";
99 hp = gethostbyname(hostname) ;
106 memcpy( (
char * )&sa.sin_addr, (
char * )hp->h_addr, hp->h_length );
109 if (::connect(fd, (
struct sockaddr *)&sa,
sizeof(sa)) == -1) {
110 fputs(
"error: connect\n", stderr);
120int FRClient::send(
const char *sendbuf)
122 int len = strlen(sendbuf);
124 if (::send(fd, sendbuf, len, 0) < 0) {
125 fputs(
"error: Send()\n", stderr);
131int FRClient::receive(
char *recvbuf)
135 memset(recvbuf,
'\0', FRSendLength + 1);
136 len = ::recv(fd, recvbuf, FRSendLength, 0);
138 fputs(
"error: Receive()\n", stderr);
149 if (::shutdown(fd, 2) < 0) {
150 fputs(
"error: shutdown\n", stderr);
G4DLLIMPORT std::ostream G4cout
static Verbosity GetVerbosity()