What I don't get is data flow among the Unix Domain Sockets .
I understand Unix Domain Socket data flow is
LocalSocket client .connect()
--> LocalServerSocket server .accept()
The client sends data to the server, straight enough that I understand.
However, for Streaming video/audio from MediaRecorder of Android, after a lot of research, I've seen every example to use a LocalSocket instead of a file for MediaRecorder is in principle as below:
https://static.foxdogstudios.com/static/presentations/keeping-it-real-time.html#/9
LocalServerSocket server = new LocalServerSocket("some name");
receiver = new LocalSocket();
receiver.connect(server.getLocalSocketAddress());
LocalSocket sender = server.accept();//LocalSocket not LocalServerSocket as in Source link
// ...
// Give the MediaRecorder our fake file
recorder.setOutputFile(sender.getFileDescriptor());
This code looks like:
MediaRecorder
--> LocalSocket sender
-->
LocalServerSocket server .accept()
--> LocalSocket receiver .connect()
What is going on??
Appearently, the sockets data flows in the opposite direction, therefore, I don't get why this code works as expected.
Could you kindly advise. Thanks.
It appears that basically, my thought is correct. The examples I've seen, at least, sender-receiver structure is something wrong.
Here's more straightforward model I made: