Hi,
    I have defiend a dameon which I have invoked from init.rc. This
daemon wait on socket.

-------------init.rc code
service myserviced system/bin/myserviced
user root
oneshot
-------------

    Every time I flash the image, the first time I am able to bind to
the socket. But on restart, I get error (98- Unable to bind to socket)
when binding to the socket.


Code snippet for socket server is as below:
-----------------
    if( (ListenerFd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0)
         exit(0);
    }

    bzero(&srv, sizeof(srv));
    srv.sin_family = AF_LOCAL;
    srv.sin_addr.s_addr = INADDR_ANY;
    srv.sin_port = htons(PORT);
    if(  bindStatus = bind(ListenerFd, (struct sockaddr *) &srv, sizeof
(srv)) < 0) {

        LOGD("agpsserver.c: Error: bind %d\n", errno);
        exit(1);
    }
--------------

Thanks in advance
Anil
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to