I am having trouble in creating named pipe in Android and the example below illustrates my dilemma:
res = mkfifo(\"/sdcard/fifo9000\", S_IRWXO);
if (res != 0
I would like to append to the accepted answer:
1) I am able to use this method to connect a socket between two native modules of an Android app.
2) write() should be in a loop since it may not write the full amount requested in the first go. For example, it should read something like:
void *p = buffer;
count = 0;
while ((count += write(clientSock, buffer, num_bytes - count)) < num_bytes)
{
if (count < 0)
{
close(clientSock);
errCode = count;
break;
}
p += count;
}
The error handling shown above is insufficient, since several error codes simply indicate to try again. See the documentation for write.