It looks like you're trying to bind to a Unix local socket with a struct sockaddr_in descriptor. This cannot work. You should either use an AF_INET socket, or use a struct sockaddr_un descriptor.
On Mon, Mar 30, 2009 at 9:16 AM, Anil <[email protected]> wrote: > > 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: [email protected] website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
