作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有代码,不是我为Blackberry写的:
public class ServerThread extends Thread {
...
String url = "socket://:12345;deviceside=true;interface=wifi";
ServerSocketConnection connect = (ServerSocketConnection) Connector.open(url);
SocketConnection sc = (SocketConnection) connect.acceptAndOpen();
InputStream input = sc.openInputStream();
...
connect
变量还可以,但是将
附加在connect.acceptAndOpen()
调用上卡在上。
localhost
输入一些信息,但不会得到它。
localhost
上另外启动一些过程?
public class MyApp extends UiApplication
{
...
public MyApp()
{
new ServerThread().start();
// Push a screen onto the UI stack for rendering.
pushScreen(new MyScreen());
}
...
最佳答案
您正在尝试通过模拟器上的Wi-Fi打开直接TCP连接。
您无法从模拟器连接到localhost,因为它使用MDS模拟器作为每个连接的代理,这又阻止了您访问localhost。 (我假设“localhost”是指在开发工作站上运行的服务器套接字)
因此,建议您在模拟器上进行测试时,从URL中删除wi-fi后缀,并使用工作站LAN上的真实IP地址连接到工作站服务器。仅在在模拟器中配置了WLAN之后,才可以在模拟器中使用“; interface = wifi”后缀,但是由于您无法在其中放置任何实际设备,因此该模拟网络几乎没有用。
关于sockets - 黑莓套接字连接-应用程序卡在acceptAndOpen()上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9916124/
我是一名优秀的程序员,十分优秀!