Hi.
Somthing know if is possible to receive (recv) from a gsoap method, how?
if((fd = socket (AF_UNIX, SOCK_STREAM, 0)) == -1) {
printf("can't create a socket\n");
return error;
}
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
strncpy(un.sun_path, SOCKET, sizeof(un.sun_path) - 1);
// set non-blocking
if (fcntl (fd, F_SETFL, O_NONBLOCK) < 0)
printf ("Failed to set fd non-blocking\n");
if(connect(fd, (struct sockaddr *) &un, sizeof(un)) == -1) {
printf("error trying to connect to the socket\n");
return error;
}
snprintf(buffer, sizeof(buffer),
"cmd=%s&username=%s&password=%s&mac=%s&clientip=%s",
option, username, password, mac, clientip);
#if 0 /*This part blocks the program*/
tv.tv_sec = 15;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(fd, &fds);
if(select(fd + 1, &fds, NULL, NULL, &tv)) {
memset(buffer, 0, sizeof (buffer));
if(recv(fd, buffer, sizeof (buffer) - 1, 0) == -1) {
strcpy(buffer, "io_error");
printf("error getting data from descriptor\n");
return error;
}
} else {
strcpy(buffer, "timeout");
printf("%s time out\n", option);
}
#endif
Thanks.
--
FMAY