+#ifndef VCL_TEST
+ {
+ int fd, errno_val;
+ struct sockaddr_un serveraddr;
+ uint8_t buffer[256];
+ size_t nbytes = strlen (SOCK_TEST_MIXED_EPOLL_DATA) + 1;
+ struct timeval timeout;
+
+ /* Open AF_UNIX socket and send an echo to test mixed epoll on server.
+ */
+ fd = socket (AF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0)
+ {
+ errno_val = errno;
+ perror ("ERROR in echo_test_client(): socket(AF_UNIX) failed");
+ fprintf (stderr,
+ "CLIENT: ERROR: socket(AF_UNIX, SOCK_STREAM, 0) failed "
+ "(errno = %d)!\n", errno_val);
+ goto out;
+ }
+ memset (&serveraddr, 0, sizeof (serveraddr));
+ serveraddr.sun_family = AF_UNIX;
+ strcpy (serveraddr.sun_path, SOCK_TEST_AF_UNIX_FILENAME);
+ rv = connect (fd, (struct sockaddr *) &serveraddr, SUN_LEN (&serveraddr));
+ if (rv < 0)
+ {
+ errno_val = errno;
+ perror ("ERROR in echo_test_client(): connect() failed");
+ fprintf (stderr, "CLIENT: ERROR: connect(fd %d, \"%s\", %lu) "
+ "failed (errno = %d)!\n", fd, SOCK_TEST_AF_UNIX_FILENAME,
+ SUN_LEN (&serveraddr), errno_val);
+ goto done;
+ }
+
+ scm->af_unix_echo_tx++;
+ strcpy ((char *) buffer, SOCK_TEST_MIXED_EPOLL_DATA);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 250000;
+ select (0, NULL, NULL, NULL, &timeout); /* delay .25 secs */
+ rv = write (fd, buffer, nbytes);
+ if (rv < 0)
+ {
+ errno_val = errno;
+ perror ("ERROR in echo_test_client(): write() failed");
+ fprintf (stderr, "CLIENT: ERROR: write(fd %d, \"%s\", %lu) "
+ "failed (errno = %d)!\n", fd, buffer, nbytes, errno_val);
+ goto done;
+ }
+ else if (rv < nbytes)
+ {
+ fprintf (stderr, "CLIENT: ERROR: write(fd %d, \"%s\", %lu) "
+ "returned %d!\n", fd, buffer, nbytes, rv);
+ goto done;
+ }
+
+ printf ("CLIENT (AF_UNIX): TX (%d bytes) - '%s'\n", rv, buffer);
+ memset (buffer, 0, sizeof (buffer));
+ rv = read (fd, buffer, nbytes);
+ if (rv < 0)
+ {
+ errno_val = errno;
+ perror ("ERROR in echo_test_client(): read() failed");
+ fprintf (stderr, "CLIENT: ERROR: read(fd %d, %p, %lu) "
+ "failed (errno = %d)!\n", fd, buffer, nbytes, errno_val);
+ goto done;
+ }
+ else if (rv < nbytes)
+ {
+ fprintf (stderr, "CLIENT: ERROR: read(fd %d, %p, %lu) "
+ "returned %d!\n", fd, buffer, nbytes, rv);
+ goto done;
+ }
+
+ if (!strncmp (SOCK_TEST_MIXED_EPOLL_DATA, (const char *) buffer, nbytes))
+ {
+ printf ("CLIENT (AF_UNIX): RX (%d bytes) - '%s'\n", rv, buffer);
+ scm->af_unix_echo_rx++;
+ }
+ else
+ printf ("CLIENT (AF_UNIX): ERROR: RX (%d bytes) - '%s'\n", rv, buffer);
+
+ done:
+ close (fd);
+ out:
+ ;
+ }
+#endif
+