hello
I am using ubuntu on android(with chroot)
I am trying to execute xev
(to change the volume button to CTRL)
but every time I trying to open up xev,
it says
unable to open the display ''
or
unable to open the display '127.0.0.1:0.0'
(when I change DISPLAY variable with export)
could somebody tell me how to solve this problem?
I can't find official error page on google
your little advice would be very helpful for me
Regards.
Taeyun.
DISPLAY=127.0.0.1:0.0 says to use TCP/IP to connect to the display 0.0. Distributions haven't configured X servers to listen on TCP for five years or more because it is a needless security risk; you need to remove -nolisten from however you execute your X, if you really wish to use TCP rather than Unix domain sockets.
But do you really need it to listen on TCP for connections? Seems unlikely -- Unix domain sockets (e.g., /tmp/.X11-unix/X0) are much more common, just use DISPLAY=:0.0 to ask for the Unix domain socket instead. You may need to link the socket into your chroot environment, depends on where client and server start from.
Once you can contact the X server from your X client, you also need to authenticate it, using xauth(1). This is annoying :) and is the single most popular reason why everyone just uses SSH X11 forwarding (ssh -X) rather than deal with TCP listening and xauth manually. (Incidentally, can you just run an sshd "inside" the chroot on a different port, so you can easily get all this magic for free? :)
Related
I've been searching for a long time with no luck.
I'm trying to get a Mac OS X application to communicate with an Android application. Nothing more complicated than a chat client type application where text is typed in Android and sent to OS X (maybe via Cocoa or even a Java app).
I'm lost how to accomplish a Wi-Fi based communication between the two. I looked into Bluetooth first, but it seemed way over my head on the OS X side. Wi-Fi I assumed would be easier to implement.
Any guidance is much appreciated.
So you want your android to communicate with your Mac , there are many ways to do it.
1- With Internet- Queueing mechanism/DB mechanism
Your android could connect to SQS #AWS and write messages to the queue. You could write code in any language on OS X that reads off the queue and returns the string
Similar implementation can be done with a database- think orchestrate.io
2-Without internet
Assuming you've setup an ad-hoc connection between your mac and your android. You could simply open a socket and send and receive data on them. It's pretty straight-forward. Your Mac will run a TCP client and show the stream and print data out as necessary.
I'm new to any sort of programming for networks, and would like a little advice before I start.
I would like to run a server (Raspberry Pi) at home, which I would like to be able to contact to run particular programs/scripts and to trigger other events on my home network (WoL, home automation stuff etc)
I would like to be able to contact it independently of the platform - i.e. from Android & Windows primarily, iOS and Linux perhaps.
I would like to have some sort of security, in that I don't want anyone else to be able to contact my RPi and operate it.
Is there some sort of standard interface that is used for this sort of thing? I was thinking of running Apache, but thought I'd check there aren't more targeted solutions available first.
Cheers
Secure Socket Shell (ssh) would be my suggestion. It's already installed under RPi AFAIK, but you probably want to generate a public/private keypair and only permit login to your server using the keypair (i.e. disable password authentication). Also restrict the allowed users to you alone. Don't do this as root; instead create some setuid scripts to perform any admin-only tasks within the server and restrict the access control on those scripts.
One more tip to avoid constant crack attempts: move the port from 22 to 422 (which could be done using the NAT config of your internet router).
You could probably use libssh, however for some client platforms you might be able to get away with a shell script implementation.
I would like to programatically make my device answer to broadcast pings (i.e pinging 192.178.1.255) while connected to a wifi network.
Is there a way i can do that ? Maybe a listener that will ping back, or a flag to set somewhere?
Thanks.
Is there a way i can do that ?
In short: Yes. But it will take some good effort to integrate the necessary components.
The key problem is that you need to listen for ICMP network packets. Such functionality is not accessible from Java and would require either JNI code or an external program. (To my knowledge, it also requires a rooted device.)
You will need a library or program that can process network traffic, such as Jpcap (which would require some modification to work on Android). You could also install and run an instance of tcpdump in the background and parse its output.
It's not possible for an app to send/receive ICMP Echo Requests on Android. (Maybe there is a way on rooted devices)
But if your basic goal is to implement some kind of local device discovery functionality (and your code runs on all devices), you can use UDP broad/multicast messages instead.
I know this question is quite old now, but I came across this looking to for an answer and managed to work it out myself.
What I did was download a root file explorer (I used Root Browser from JRummy Apps) and navigate to /proc/sys/net/ipv4 edit icmp_echo_ignore_all so that it is a 1-line, 1-character file that simply says 0 (when I opened the file, it was set to 1)
No reboot, ICMP requests started working upon saving.
I have a task to integrate a Bluetooth device into my application. Now my requirement is very specific. The device has a specific communication protocol which relies on certain ACKs but I figured it would make my development much easier if there was a program that let me test communication with the device.
I was wondering if there was a program for Linux, or perhaps a simple Android program which let me communicate with any Bluetooth device with a series of pings using data I enter and simply log the responses.
EDIT: I might not have been clear enough in my question.
I have a scale that I need to integrate into my application, and the scale has a protocol similar to this:
Get a specific byte string from device
Transfer data
Transfer packet for disconnection
Receive acknowledgement for disconnect packet
Disconnect
Now when I have to issue a POST request from my application, I usually build a test script online so I can test if the POST works properly.
I was wondering if there was something similar I could do with the device.
Thanks
Your question is not clear enough. To communicate with a BT device, you need to know what profile your device supports. Depending on that, you can find a way in Android or Linux or windows to communicate with the device.
The simplest way is to open an RFCOMM channel from android/PC and transfer data to and from the device. For this the device has to support the serial port profile (SPP). If you want to do this in Android, look for the BluetoothChat example from google.
If you want to use a PC/mac/linux look at the Bluez python module. It's really simple to use. There are plenty of other options too..
I was looking for something like SENA BTerm. It lets me connect to any device and send whatever data I wish.
It is an extremely useful tool for testing my code.
http://www.sena.com/download/manual_bterm/overview.html is where you can find it.
I'm trying to learn android and for my app i have few questions.
If i type a computer name on the EditText in my android phone, I
should be able to ping the device (So basically i need to first
resolve the ARP to get the mac address of the device which I want to
ping and then send the ping as an ICMP request).
I believe there is some command to retrieve the computer name and
send this ping command, but i would like to do it the hard way so
that i can learn stuffs better - It would be nice if you can show me
some pointers to some tutorial apps and open source code which does
similar tasks.
Once I have identified and connected to the device. I should be able
to start a chat with the device.
Assume the second device is also an android device, how can I
establish basic message sending from one android device to another.
Basically my app will be a client and server (I guess 2 services - service listening to sockets for incoming messages and client can send out messages).
Does anyone know any sample app / tutorials [basically code examples] which does this in android.
To Nr.1
I'm not quite sure why you first need to ping the device, as you could simply try to connect to the given device (using a timeout) and see if it can be connected.
I found some informations on this, here.
To Nr.2
So, if you want your Devices to communicate to each other, you'll want to use Sockets.
But, if your App is only for chatting and you don't need to know if the last send package was successfully send, you could also use UDP instead of TCP (So you don't need your application to run both the Server and the Client-Socket).
Although, all your questions could have been answered by doing a little googleing...