问题标签 [localsocket]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - 使用 LocalServerSocket 时出现“IOException:再试一次”
有没有人有关于例外“再试一次”的更多有用信息?
我正在使用LocalServerSocket
and的应用程序之间发送位图LocalSocket
:
输出:
输入:
[为清楚起见,删除了 try/catch 等]
android - 在 Android 中使用 LocalSocket 发送和接收 UDP
我有一个本机应用程序,它使用此代码打开一个 UnixDomain 套接字。
上面的代码正在运行,因为我可以看到套接字已创建。
现在我想从我用 Java 编写的 android 应用程序发送一个 UDP 数据包。我相信我需要使用 LocalSocket 类。问题是我不知道如何将 LocalSocket 类用于 UDP。我看到的所有教程都是针对 TCP(SOCK_STREAM) 的。
我尝试使用下面的代码连接到创建的套接字,但它们给了我错误
这给了我Connection refused
错误
我也尝试绑定到同一个文件,但它显示Address already in use
错误。
我可以将 LocalSocket 类用于 UDP 还是只为 TCP 设计?
android - 在 Android 中使用本地套接字将实时视频录制保存到 sd 卡 - 视频无法播放
尝试捕获视频并使用本地套接字以 Mp4/3gp 格式将其保存到 sd 卡。能够逐字节将字节写入 sd 卡,但视频文件不可播放。我经历了很多例子:
https://github.com/fyhertz/spydroid-ipcamera
https://github.com/mconf/sipdroid
还有很多。我注意到有人暗示这可能是文件头的问题。我也尝试从标题中跳过那些“mdat”数据:
最后没有什么对我有用。我需要做些什么才能使这些视频文件可以使用本地套接字播放
linux - 没有地址首先使用双向 unix 域套接字运行
我有两个通过 unix 域套接字(本地套接字)进行通信的守护进程(一个客户端和一个服务器)。我遇到的问题是服务器第一次使用recvfrom函数接收到数据报,然后recvfrom函数提供的客户端地址为空。但是,提供的客户地址的大小似乎是正确的。如果我增加客户端守护程序中的地址长度(更长的名称),这将反映在服务器地址大小的增加大小上。收到的数据也是正确的。
请注意,我只有在服务器第一次收到数据报时才会遇到这个问题。当收到其他数据报时,地址字段是正确的。
那里有任何专家了解可能出现的问题吗?
服务器代码:
}
客户端代码:
c - 本地linux套接字接收旧数据
我刚刚写了一个程序,使用本地套接字在两个进程之间进行通信
如果客户端向服务器发送一条消息,然后关闭连接,服务器将只收到一条消息
客户:
服务器:
但是,如果客户端发送一条消息,并且服务器也将一条消息(任何字符串)发送回客户端,则客户端关闭连接,服务器将收到客户端发送的旧消息
客户:
服务器:
这是我的初始化代码:
android - 带有 LocalSocket 的 Android MediaPlayer 无法正常工作
我正在尝试使用 MediaPlayer 从 LocalSocket 播放媒体。流是 MPEG-TS 类型,在 LocalSocket 输入流中可用
以下代码尝试到setDataSource
of FileDescriptor
,LocalSocket
但失败了。
setDataSource 失败,出现以下异常。
调试日志表明错误主要是由于这个,fstat
LocalSocket 的文件描述符将文件的大小返回为 0。
但是如果我尝试wsIns.getInputStream().available()
这个 api 会提供非零的可用字节数。
注意:使用相同的错误p.setDataSource(fp);
java - 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 problematic activities), so I went ahead and ran it. Upon clicking the navigation icon to start a new activity, the screen dimmed a bit, and after about 30 seconds, the entire screen was white with the exception of the native android dropdown menu at the top still visible.
I went ahead and tried to 'Stop' the app, at which point the android studio froze. By running a series of commands (as I later discovered) or by simply closing adb.exe
in the task manager, android studio resumed operation but disconnected from the device of course. My device however, had to do a full reboot as it seems the entire system was bogged down with some issue and would take 10x the usual time to open another app.
Testing
Upon retesting I noticed a few things
- My
logcat
would print this over and over for about 30 times or more
Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.monkeyPatchExistingResources
Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.pruneResourceCache
IO Error creating local socket at church.rmhymnal
java.io.IOException: Address already in use
at android.net.LocalSocketImpl.bindLocal(Native Method)
at ........
- Upon running the command
netstat -o -n -a | findstr 5037
in command prompt, I would see a massive list of TCP ports that had been apparantly opened repeatedly. (Some of those with TIME_WAIT would eventually be marked as ESTABLISHED
Code
I'm not sure what could be causing the issue but I'll drop the code for the activity I am calling, as well as the calling method below.
Calling function in Main Activity
IndexActivity.java (Activity to be called)
Clarifications
All the methods before I created listIndex()
had worked perfectly. However after adding it as well as a few other methods in a different activity, it never worked since.
Final Thoughts
- Is it a problem related to my code or is it an issue with my adb or android studio?
- Could the issue be brought about by some error in another class that's not called in this particular method?
Any ideas leading to a possible solution would be highly appreciated, as my ability to develop and test is slowed greatly since I have to restart the testing device 9 times out of 10.
android - android LocalSocketAddress.Namespace.filesystem 无法连接
我试图重新编译一个 2014 年左右编写的 android 应用程序。除了 LocalSocketAddress 问题之外,大多数东西都在工作。这是不起作用的代码示例
在 Logcat 中,我看到以下异常:
当前编译器安卓:2.2.3。我的 buid.gradle 文件我提到了 minSdkversion 是 23 以及 tagetSdkversion 是 23。还要设置清单文件的用户权限。
有人可以帮我解决这个问题吗?
android - Android localSocket 连接被拒绝~
最近写了一个framework和app之间通过localsocket通信的例子,原生服务端socket代码:
客户端套接字:
我使用 FILESYSTEM 创建 localsocket,但运行 logcat 是:
我在touch文件下的/data/data/com./files目录下使用ADB shell,然后运行,结果是:
我在公司用同样的代码是通讯,公司的Android源码是4.4,我家用的是Android源码6,google是有限制的,我希望他们能正常通讯,请问怎么解决?
java - 使用 SOCKET_SEQPACKET 套接字类型初始化 LocalServerSocket
有没有办法用SOCKET_SEQPACKET类型初始化 android LocalServerSocket以避免处理数据包边界?