Questions tagged [localsocket]

Local socket programming is a form of IPC (Inter process communication). Just like internet sockets make use of TCP/IP protocol stack to deal with sending or reception of internet packets, local sockets can be connection-oriented or connection less enabling different processes in the system to communicate via file descriptors. Generally these socket file descriptor allotted are hidden from user but can still be retrieved by use if fileno() call.

Local sockets make use of socket file descriptors to communicate between different processes within a system. An application dealing with local socket programming, is as vulnerable to data race conditions as any other IPC model; hence, we make use of mutexes and semaphores to deal with the problems of data races and synchronization.

A server listens on the "listening socket". The following system calls enable the server side to act as daemon applications to further accept connections from the clients.

The server performs, socket(), bind() and listen() system calls to open a daemon socket and waits for the clients to perform socket() and connect() system calls and accept() call enables the server to establish a connection with the client

Once the connection gets established, the server and the client can exchange messages by using send() and recv() calls or by write() and read().

All the above system calls and related information can be found in the man pages in linux.

16 questions
24
votes
1 answer

Save real time video recording to sd-card using Local Socket in Android - Video not playable

Trying to capture a video and save it to sd card in Mp4/3gp formats using local socket. Being able to write bytes by bytes to sd card but the video file is not playable.I have gone through many examples…
neoengg88
  • 241
  • 2
  • 5
5
votes
2 answers

How to fix 'java.lang.IllegalStateException' on 'MediaRecorder.start()' using LocalSocket

I'm trying to develop a circular video recorder and I need to save the recorded video in a buffer to recovery the last X minutes in a certain moment. The problem is that when I run 'start()' method of MediaRecorder object:…
Rafael
  • 155
  • 1
  • 3
  • 15
5
votes
5 answers

"IOException: Try again" while using LocalServerSocket

Does anybody have more helpful information on the Exception "Try again"? I'm sending Bitmaps between apps using LocalServerSocket and LocalSocket: Output: socket = new LocalSocket(); socket.connect(new LocalSocketAddress(SOCKET_NAME)); fos = new…
Graeme
  • 25,714
  • 24
  • 124
  • 186
2
votes
0 answers

IllegalStateException when doing MediaRecoder.start() on Android

I am stuck with an issue. I am trying to do a live audio streaming from the device to the server. The device is connected to the server over a socket. I have created a LocalServerSocket and setting the MediaRecorder.setOutputFile to this local…
2
votes
0 answers

Android localSocket connection refused~

I recently wrote an example of communication between framework and app through localsocket,The native server socket code : #include "base.h" #include "util.h" namespace yanghui{ JavaVM* getJavaVm(); Constants* getConstants(); }; …
Nipuream
  • 21
  • 3
1
vote
1 answer

Can I use a Unix domain socket on Android?

Can I use a Unix domain socket on Android (both server and client on the same Android device, for IPC)? Or, must I use LocalSocket?
gpu
  • 129
  • 10
1
vote
0 answers

How to add LocalSocket to Selector in Android?

I am creating a local socket like this: LocalSocket sock = new LocalSocket(); sock.connect(new LocalSocketAddress("my-abstract-name")); Selector sel = Selector.open(); How to add LocalSocket sock to Selector sel?
zomega
  • 1,538
  • 8
  • 26
1
vote
0 answers

How to communicate between LocalSocket in java and unix socket in c++?

I create socket client in Android Java code: LocalSocket sock = new LocalSocket(LocalSocket.SOCKET_DGRAM); sock.connect(new LocalSocketAddress(path)); my server is create in JNI. when i install to my device, sock.connect often throw connection…
jie zi
  • 51
  • 1
  • 4
1
vote
0 answers

Android MediaPlayer with LocalSocket not working

I am trying to play media from LocalSocket using MediaPlayer. The stream is of type MPEG-TS, which is availale in a LocalSocket input stream Following code tries to setDataSource to the FileDescriptor of LocalSocket, but failes. LocalSocket wsIns =…
nmxprime
  • 1,506
  • 3
  • 25
  • 52
1
vote
2 answers

Send and Receive UDP using LocalSocket in Android

I got a native app that opens a UnixDomain socket with this code. struct sockaddr_un local; int len; int fd; fd = socket(AF_UNIX, SOCK_DGRAM, 0); local.sun_family = AF_UNIX; strcpy(local.sun_path, "path.to.socket"); len = strlen(local.sun_path)…
kuchi
  • 840
  • 11
  • 19
0
votes
0 answers

is it necessary to use protobuf for domain socket while IPC?

is it necessary to use protobuf for domain socket(local socket) while IPC? if there is only 1 struct(not big) as protocol, no need to use protobuf for domain socket? otherwise, if there were many structs as protocols, need to use protobuf as…
gpu
  • 129
  • 10
0
votes
1 answer

Initialize LocalServerSocket with SOCKET_SEQPACKET socket type

Is there a way to initialize an android LocalServerSocket with SOCKET_SEQPACKET type to avoid handling packet boundaries?
Eldar
  • 149
  • 2
  • 12
0
votes
1 answer

android LocalSocketAddress.Namespace.filesystem can not connect

I was trying to recompile an android application that was written around 2014. Most of the stuff is working except LocalSocketAddress issue. Here is sample of code which is not working private final LocalSocketAddress mSocketPath; mSocketPath…
0
votes
1 answer

Problems with Android Debug Bridge sockets: IOException

Problem Hello all, I've come across a very problematic issue/bug with ADB or Android Studio or both. So I have my android phone connected via USB with USB Debugging enabled testing my app. I had added a few functions and wanted to test them (two…
Keno
  • 2,018
  • 1
  • 16
  • 26
0
votes
1 answer

local linux socket receives old data

I just wrote a program that uses local socket to communicate between two processes if client send one message to server, and then close the connection, server would only receive one message clent: send(srvfd,data,size,0) close(srvfd) server: …
Jun
  • 35
  • 1
  • 8
1
2