Hot answers tagged

6

Before I ran a few commands on my raspberry pi I had less than 4 MB of memory left! Wrong. You had 76.5 MB left. total used free shared buffers cached Mem: 120544 116840 3704 0 4268 68612 -/+ buffers/cache: 43960 76584 ^^^^^ Please read ...


3

Your host code is host = `192.168.0.1` while the client code is host = '192.168.0.10' As you say connecting with telnet works, the address of the host must be 192.168.0.1, so the client should connect to 192.168.0.1 and not to 192.168.0.10.


3

This answer describes how to transfer plain text between PC and RpiB, using a serial cable. At the PC side, an usb to serial adapter can be used to converts PC's USB signals to 5V UART serial signals . At the Rpi3 side, there are 2 GPIO pins: UART0 Txd, Rxd for data transfer at 3.3V level. These Rpi UART signals at 3.3V should be shifted up to 5V, ...


2

I think the best you can do is use a gpio event callback to set a shutdown flag and have your socket loop act on the flag when it is seen. If the socket loop may not be entered for some time then you will have to find an action which triggers a socket message. Alternatively use your gpio event callback to force a restart itself.


2

Have you considered putting the TCP socket receive code inside your Python script? Or you can just write another Python script that does a socket create, socket listen, and socket receive before calling your other Python script. Here is some of the code to do this from http://pymotw.com/2/socket/tcp.html: import socket import sys # Create a TCP/IP socket ...


2

You don't need to measure performance here. Using the loopback does not use any external network at all, hence why it still works even if you're not connected to any external network. Because of that fact, latency and bandwidth will definitely be lower (in the order of nanoseconds/microseconds versus milliseconds via LAN). CPU affinity would be a ...


2

I managed to do it. Yes, I first set up the RPI as a standalone network wireless access point. Then, I wrote a program in C to set up RPI as a TCP Server to listen for connections from my Android phone with the Geany ide. Here is the tutorial I used to help me with the C programming. TCP Socket Tutorial


1

Leamas, thank you very much! Dealt with the socket and the device. Confused by the old instructions for using lirc. I downloaded a good config file and ran irsend without specifying a socket and everything worked irsend SEND_ONCE PHILIPS_15PF4121 KEY_POWER


1

You should start your script After=mpd.service. I think it isn't needed to start After=network-online.target because this is already managed by the mpd.service. You can check it with systemctl cat mpd.service. You can also omit Type=simple because it's default. So I would suggest the following unit: [Unit] Description=start listening to button presses After=...


1

You cannot bind to ports below 1024 without the CAP_NET_BIND_SERVICE capability. The root user has it. Or, you can assign it to an executable with $ sudo setcap 'cap_net_bind_service=+ep' /path/to/program But, caveat, the latter does not work for scripts. You had to add the capability to the interpreter itself, which is a huge security hole. Don't do that....


1

1) You can set host to host = '0.0.0.0' or host=''. 2) You don't really need an Android phone to test the socket connection, all you need is to run another session of terminal on your computer or even on the same Raspberry Pi and using command curl http://192.168.100.100:5560 to be as a client(assuming this is your Raspberry Pi's IP address and where the ...


1

You are confusing network layers. The ad-hoc vs. Infrastructure networking is done on the media layer. E.g. for Ethernet, the only thing you have to do is connecting two devices by a cable. They have their MAC address built-in and all the other configuration (10/100/1000Mbit etc.) can be autoconfigured by the hardware. For wireless, it's a bit more ...


1

Finally I find the right type of the connector after a long search on the digykey. Today I solder the new connector and Pi works fine. Part Number: 1040310811 Manufacturer: Molex http://www.digikey.com/product-detail/en/molex-llc/1040310811/WM6357CT-ND/2804769


1

Finally: The reason I was unable to connect both ends to the domain socket was because (for an unknown reason to me) I was running my logic out of Idle. If I fired up two different terminal sessions; one with the creator, and the other with the client, all worked as expected. There's three days of my life that I won't get back (unless I forget how I got ...


1

Static addresses have nothing to do with it. Sending to a broadcast address is a privileged operation. You either need to be root, or you need to have the CAP_NET_ADMIN (and hopefully some day the CAP_NET_BROADCAST) capability.


1

I can't help with your Python, but this strikes me as using a sledgehammer to crack a nut. I have avahi on my Pi so I can "discover" the IP with hostname.local. I am pretty sure avahi starts automatically on newer kernels, or by dhcpcd. I connect with ssh pi@hostname.local. This may not work with older Windows (due to the non standard use of .local), but ...


1

I solved the problem without OBEX. I used socket's recv() and send(). After accept connection @ServerSide def sendFile(self ,sendPath,packageSize): """ Sends file to the device @param sendPath is file path address @ host device @param packageSize is packet size of pure data @BluetoothSocket """ if (packageSize == None): ...


1

Everyone of the 3 git repos you linked is for a specific component. The tests one constains a full program. You can infer that the Kernel needs patching, as well as some other components, from the first paragraph of the link you pasted: The project does not do releases since the source code is distributed as patches for specific versions of Linux kernel, ...


1

Looking over the link you provided, the likely problem is that the environment variable JS_HOME is set for the pi user (or whatever user you installed node as) but not for root. The simpleset way to fix this is to use the full path to the npm commnad. To determine what the proper path is type which npm in the terminal. this will return the full path. ...


1

Sockets aren't part of standard C (or C++) because they are platform specific. Since you're almost certainly using linux on the pi, you want to use the glibc implementation. That's a C reference, as GNU's C++ library does not include any additional wrappers; the normal approach would be to write your own. There's an example of such here. Boost has a lot ...


1

You might want to have a look at WebIOPi: WebIOPi is a REST framework and a webapp which allows you to control your Raspberry Pi's GPIO. Using this you can control all the GPIO directions and Values from the browser graphically. Basically they built this on Rest framework.


Only top voted, non community-wiki answers of a minimum length are eligible