View Single Post
Posts: 60 | Thanked: 33 times | Joined on Apr 2010
#37
Originally Posted by tz1 View Post
Code:
static void sendnokgps(char *cmd)
{
    int n, len;
    struct sockaddr_un igps;
    n = socket(AF_UNIX, SOCK_STREAM, 0);
    if (n >= 0) {
        igps.sun_family = AF_UNIX;
        strcpy(igps.sun_path, "/var/lib/gps/gps_driver_ctrl");
        len = strlen(igps.sun_path) + sizeof(igps.sun_family);
        if (connect(n, (struct sockaddr *) &igps, len) != -1) {
            char buf[4];
            if (!fork()) {      // this can take a while
                write(n, cmd, strlen(cmd));
                read(n, buf, 4);
                close(n);
                exit(0);
            }
            close(n);
        }
    }
}
if the other end supports RFCOMM and for a certain reason doesnt reply, will the read(n, buf, 4); make the system freeze?
or u recommend me to use just BLUEZ rfcomm API to communicate (on RS232) to a bluetooth module from maemo ?

Thanks
__________________
HOWinUK.co.uk - The Real Student Guide in the UK

Last edited by raedbenz; 2010-07-17 at 20:38.