Sorry ... My fault!!!

It works... I was changing a different copy and building a different one .. The 
socket was initially in /etc ... I changed it to /data/local but in a different 
copy :p


Sent from BlackBerry® on Airtel

-----Original Message-----
From: Suman Saraf <[email protected]>
Date: Tue, 15 May 2012 16:57:52 
To: <[email protected]>
Cc: android-porting<[email protected]>
Subject: Re: [android-porting] Error on socket bind

Can you print the errno on bind failure? If you have a small program, just run 
it via strace and see the return value for bind.

I ran your same program with a few includes etc. and it worked. I built it 
statically on Linux (without NDK) and pushed it to an Android instance and it 
worked without any problems.

On 15-May-2012, at 4:39 PM, [email protected] wrote:

> Yes , the directory exists and I have permissions to write to it
> 
> ------Original Message------
> From: Suman Saraf
> To: [email protected]
> Cc: android-porting
> Subject: Re: [android-porting] Error on socket bind
> Sent: May 15, 2012 4:22 PM
> 
> Does a directory /data/local exist on the filesystem and do your program have 
> permissions to write to it?
> 
> On 15-May-2012, at 4:01 PM, NimeshChanchani wrote:
> 
>> I'm getting an error on socket bind in android . i'm not doing this
>> through NDK , but cross compiling for android. I'm using AF_UNIX. code
>> snippet below. Any Idea?
>> 
>>   sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
>>   if (sockfd < 0)
>>   {
>>       printf("Error opening socket");
>>       return -1;
>>   }
>> 
>>   bzero((char *) &server_addr, sizeof(server_addr));
>>   server_addr.sun_family = AF_UNIX;
>>   strcpy(server_addr.sun_path, "/data/local/ipctest");
>>   unlink(server_addr.sun_path);
>> 
>>   if (bind(sockfd, (struct sockaddr *) &server_addr,
>> strlen(server_addr.sun_path) + sizeof(server_addr.sun_family)) < 0)
>>   {
>>       printf("Error on binding socket");
>>       return -1;
>>   }
>> 
>> -- 
>> unsubscribe: [email protected]
>> website: http://groups.google.com/group/android-porting
> 
> 
> 
> Sent from BlackBerry® on Airtel

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to