I have a raspberry pi zero and a HC-SR505 (not 501, which apparently is what I should have bought). I'm a programmer, with only a little electronics from long ago, but some people suggest the it will not work, something about 3.3v vs 5v. Others say it will work. I don't want to waste my time, so I thought to ask someone here.
HC-SR505 Mini Infrared PIR Motion Sensor
Is there an easy way to switch from hdmi to bluetooth audio seemlessly in raspberry pi?
I'm on raspbian stretch, I had an android tv box that broke down so I used a raspberry pi 3 I had around for uni to replace it. In the android tv box, if I connected a bluetooth headset, it would automatically route all audio to it but in the raspberry, I have to manually go to the sound settings and tell it to switch. Is there a way to make the raspberry work the way the android did for switching back and forth to bluetooth?
Cannot boot into desktop after crashing
Good day all,
I am new to the Raspberry Pi. I have just purchased a Raspberry pi 3. I downloaded the Raspbian OS and installed it on a brand new 16GB Kingston microSD card.
First time I was successful booting into desktop, set up into my WIFI network. I opened Chromium and opened a youtube page... The screen froze for 10 mins with no response to any keyboard nor mouse. I unplugged the power source.
Upon start up, I could see the booting image, raspberry pi symbol, then the screen went black with a prompt.I can manage to get it to go to console Ctrl+Alt+F1
please let me know what I can do from here.
Thank you.
Failed to create MMAL component b'vc.ril.camera': Out of memory
I am trying to run a simple script that listens for a button click and then takes a picture. Once two pictures have been taken it compares the two using OpenCV to calculate the difference. I am running into this error when running my script followed by the script itself:
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)Traceback (most recent call last): File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/camera.py", line 456, in _init_camera self._camera = mo.MMALCamera() File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/mmalobj.py", line 2279, in __init__ super(MMALCamera, self).__init__() File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/mmalobj.py", line 633, in __init__ prefix="Failed to create MMAL component %s" % self.component_type) File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix)picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.ril.camera': Out of memoryDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "camera-daemon.py", line 12, in <module> camera = PiCamera() File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/camera.py", line 431, in __init__ self._init_camera(camera_num, stereo_mode, stereo_decimate) File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/picamera/camera.py", line 460, in _init_camera"Camera is not enabled. Try running 'sudo raspi-config'"picamera.exc.PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.from picamera import PiCamerafrom io import BytesIOfrom PIL import Imagefrom gpiozero import Buttonfrom signal import pausefrom time import sleepfrom database import insertfrom skimage.measure import structural_similarity as ssimimport cv2button = Button(17)camera = PiCamera()camera.resolution = (400,400)def capture(): image1 = capture_stream(False) sleep(3) image2 = capture_stream(False) diff = compute_diff(image1, image2) print(diff)def prepare_camera(preview): global camera # if preview is passed we want to use the preview if preview: camera.start_preview() # these print statements help for debugging as well as # allowing time for the camera to warm up print("taking picture in") print("3") sleep(1) print("2") sleep(1) print("1") sleep(1) # stop the camera's preview if preview: camera.stop_preview()def capture_stream(preview): global camera stream = BytesIO() prepare_camera(preview) # save the image to the stream and return it camera.capture(stream, format='jpeg') # rewind the stream so we can read its contents stream.seek(0) return Image.open(stream)# compute image diffs based on structural similaritydef compute_diff(A, B): imageA = cv2.imread(A) imageB = cv2.imread(B) imageA = cv2.cvtColor(imageA, cv2.COLOR_BGR2GRAY) imageB = cv2.cvtColor(imageB, cv2.COLOR_BGR2GRAY) return ssim(imageA, imageB)button.when_pressed = captureprint("running...")pause()
I have already read the FAQ and tried their suggestions. I have also tried most of the solutions on all of the other stack exchange questions with this same or similar issues. None have worked. Most recently I have been trying to slowly increase the memory split and it still is throwing this error.
EDIT:I think it's important to note that the camera works fine when I run a separate script with only camera related code in it so its not an issue with how the camera is connected.Double check your camera's connection Although my test scripts were working at first, at some point my camera got disconnected.
I am using Python 3.4, PiCamera 1.13, and OpenCV 3.4.
I will be happy to provide any more information is needed. Any help is greatly appreciated!
How to enable ros-kinetic-desktop-full
I'm beginner of raspberry pi and currently I'm installing ROS packages but further I proceed all the commands.
$ sudo apt-get update $ sudo install ros-kinetic-desktop-full
The upper commands shows the error : unable to install ros-kinetic-desktop
.
Raspberry Pi Zero Internet connection through USB for linux OS
I connected my Pi Zero to my PC ( Linux LMDE 3 Cindy) via USB port successfully, SO i want to connect to internet via my laptop which is connected to internet by its WIFI.
I found this instruction or this question via raspberrypi.stackexchange but those are working for window or MAC OS,but i don't find it for Linux!!!!
SO i need the similar instruction for enabling sharing my internet via USB enp0s20f0u1
device (PI Zero) in Linux. for example in windows we need to :
In the WiFi Properties window, click on the “Sharing” tab : similar to this photo:
So in Linux version what is the similar instruction to doing this?
Thanks a lot.
ALSA Errors on Pi 3B+ using SpeechRecognition and PyAudio (Original Post missing stuff)
Using PyAudio I simply ran this piece of code:
import pyaudiop = pyaudio.PyAudio()for x in range(p.get_device_count()):print(p.get_device_info_by_index(x).get('name'))
Getting these Errors:
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directoryALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directoryALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsaALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directoryALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directoryALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsaExpression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file or directory)attempt to connect to server failed
Control GPIO pins from C
Most of the libraries, in multiple languages, interact with the GPIO pins via /sys/class/gpio/export
, /sys/class/gpio/import
, /sys/class/gpio/gpio10/value
, etc. However the linux kernel docs clearly state that is the legacy way of doing things.
What is the non legacy way of doing things?
If I understand correctly in kernel space I would use these functions or standard kernel drivers for common GPIO tasks.
What would I use for user space? Is there a Sysfs interface for the non legacy?
PS: I aware the kernel docs state that the legacy integer-based interface although considered deprecated is still usable for compatibility reasons. However I'm not interested in using that legacy code.
Ways to forwarding traffic from both interfaces to another Raspberry Pi
In the below setup, Raspi 2 (3B) needs to get a copy of the TAP traffic from Raspi 1, for both eth0 and eth1, preferably without an additional switch.
I have another spare usb-to-ethernet adapter. Do I bridge both interfaces? IP-forward traffic? Use a software to mirror traffic? If anyone could provide detailed explanation, that would be very much appreciated.
The rationale for such a setup is to test and compare some softwares.
A second question would be, if there is a more efficient way to have a raspi cluster share that TAP network feed with different tools on both raspis, I would love to hear that as well!
I am currently trying:
iptables -t mangle -A PREROUTING -i eth0 -j TEE -gw <raspi2>
But either "multiple -j flags not allowed" is thrown, or "gateway is an unknown option" is.
Can raspberry pi 4 B boot from 256 GB SSD that uses USB adapter? [closed]
I installed raspbian on the Samsung Evo 860 256GB SSD. The SATA adapter and did not power up when I plugged it into the raspberry USB port. I think that its the power supply. Raspberry 4 B may not have enough power on the port to run the boot. The drive draws about 100 mA of current. Raspberry Pi 4 B, has 3.0A PSU current capacity, 1.2A peripheral current draw, active current consumption 600mA. I guess that's why it doesn't work.
Colorful pixels showing on screen pi4
I just received a new Raspberry Pi 4 4GB version. From the time of the first boot, I have colorful pixels showing up in different places on the screen. I'm using an FHD 1920x1080 screen and I have tried both of the HDMIs on the pi. I'm using a microHDMI to HDMI converter cable. The HDMI connector that is the closest to the headphone jack works best. I've also tried setting different amounts of RAM on the GPU, but nothing works. At the moment I set it on 512MB. I tried editing the config.txt but it doesn't help. I'm using the official USB-C power supply. I would be thankful for any help.
Getting a NRF24L01 module running with Java
I'm currently trying to make a NRF24L01 module work by using Java. I found this library that makes use of the JNI, but I can't get it to work.
When I try to run the provided example code the Raspberry Pi just hangs and the CPU rises to 100% after (or rather while) running rf24.begin()
.
I digged a little bit into the code and found out that the reason it hangs is due to an endless while loop inside the bcm2835_spi_transfernb()
function of this file.
The function is the following:
void bcm2835_spi_transfernb(char* tbuf, char* rbuf, uint32_t len){ volatile uint32_t* paddr = bcm2835_spi0 + BCM2835_SPI0_CS/4; volatile uint32_t* fifo = bcm2835_spi0 + BCM2835_SPI0_FIFO/4; uint32_t TXCnt=0; uint32_t RXCnt=0; // This is Polled transfer as per section 10.6.1 // BUG ALERT: what happens if we get interupted in this section, and someone else // accesses a different peripheral? // Clear TX and RX fifos bcm2835_peri_set_bits(paddr, BCM2835_SPI0_CS_CLEAR, BCM2835_SPI0_CS_CLEAR); // Set TA = 1 bcm2835_peri_set_bits(paddr, BCM2835_SPI0_CS_TA, BCM2835_SPI0_CS_TA); // Use the FIFO's to reduce the interbyte times while((TXCnt < len)||(RXCnt < len)) { // TX fifo not full, so add some more bytes while( (bcm2835_peri_read(paddr) & BCM2835_SPI0_CS_TXD ) && (TXCnt < len ) && !(bcm2835_peri_read(paddr) & BCM2835_SPI0_CS_RXR) ) { bcm2835_peri_write_nb(fifo, tbuf[TXCnt]); TXCnt++; } //Rx fifo not empty, so get the next received bytes while(((bcm2835_peri_read(paddr) & BCM2835_SPI0_CS_RXD))&&( RXCnt < len )){ rbuf[RXCnt] = bcm2835_peri_read_nb(fifo); RXCnt++; } } while(! (bcm2835_peri_read(paddr) & BCM2835_SPI0_CS_DONE) ){} if(TXCnt == len){ bcm2835_peri_set_bits(paddr, 0, BCM2835_SPI0_CS_TA);}}
The problem is that the two while loops inside the outer while loop are never entered and therefore the exit-condition cannot occur turning this into an endless while loop.
Unfortunately I have no idea why that happens. Is it possible that this is due to a SPI related problem, like me forgetting to setup something? I did enable the SPI interface and validated it multiple times and also tested it. It seems to be working correctly. I also checked my wiring multiple times and I'm confident that its correct.
I would appreciate a little input, since I am really lost regarding this right now.
My code for making 2 × 3V - 6V DC motors in L298N motor board is not working
this is in mu
from gpiozero import Robot
robby = Robot(left=(7,8), right=(9,10))
this is in the Raspberry Pi terminal
python robby.forward()
# Then it says 'robby' is to defined, I don't know why it says that. I defined 'robby' in the mu command. The motors and motor board are clearly working, just not the code.
RPi 4 running Ubuntu Server 20.04: can't connect to WiFi
I'm trying to run my Raspberry Pi 4 on Ubuntu Server 20.04 (64bit) following this tutorial. When I reached 4. Boot Ubuntu Server
, my RPi had no IP address (I switched to using a monitor when doing a headless setup failed, and calling hostname -I
returns a blank line), which I believe is the result of having no internet connection, further demonstrated by sudo apt update
failing with every line saying temporary failure resolving 'ports.ubuntu.com'
. I also get a blank line when calling arp -a | findstr b8-27-eb
from the Windows command prompt.
The tutorial had me modify the network-config
file before inserting the card into the RPi which I did, and through some exploring, this had the following effect on /etc/netplan/50-cloud-init.yaml
(with WIFI-NAME and WIFI-PASSWORD being what they should be):
# this file generated from information provided by the datasource. Changes# to it will not persist across an instance reboot. To disable cloud-init’s# network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config-cfg with the following:# network:{config: disabled}network: ethernets: etho: dhcp4: true optional: true version: 2 wifis: wlan0: access-points: WIFI-NAME: password: WIFI-PASSWORD dhcp4: true optional: true
In spite of this, my RPi 4 is still unable to connect to WiFi. If it's relevant, the first time I booted the RPi I didn't actually get the IP address since I disliked the angle of the cord so I unplugged it after a minute or two, plugged it back in, and on the second boot was when I attempted to get the IP.
What am I doing wrong? Or is the issue perhaps with Ubuntu 20.04 and I should use Ubuntu 18.04.4 until 20.04 stabilizes?
How to start Qt application in startup console menu?
I have a simple Qt application that can be started over the Qt Creator from the host on the Raspberry Pi during the initial command prompt after booting by using egl.
But I got the error Could not initialize egl display
when I try to start the application from the console. So is it possible to launch the application without the Qt Creator on the host computer on the Raspberry Pi when no display service, like X, is running?
rpi3b+ not showing on local network devices list
Problem
Cannot ssh into Pi connected within local network.
Details
Raspberry Pi 3B+ with fresh install of Raspbian Buster. (freshly installed as an attempt to fix said problem)
- Connected and associated with local Wi-Fi network (while connected to display).
- IP address is assigned and can be shown using the
ifconfig
command. - SSH server is turned on through
raspi-config
menu, can ssh into itself.
- Cannot discover Pi using Advanced IP Scanner or Fing. (Same network)
- Can discover Pi through router settings page. IP address is correctly assigned to said Pi in DHCP settings.
- Connecting to Pi using puTTY through ssh connection times out. (Windows)
- Connection to Pi using ConnectBot through ssh connection fails. (Android)
Any advice would be greatly appreciated.
Control LED as traffic lights from web using Apache server and PHP
Hi I am a newbie on this kind of projects and now I am starting with a project where I control 3 LEDs from web.It works to control each one, but now I want to make something like traffic lights, meaning on a start button each led to be on for 2 seconds at a time, until I press a stop button.That works too but the problem is I can't get it how to stop them.I am using wiringPi library with php (also new to this language).This is the html part:
<html><head><title>Control LED with Raspberry Pi using Apache Webserver </title></head><body><center><h1>Control LED from web using Apache Webserver</h1><form method="get" action="index.php"><input class ="red" type="submit" value="Turn Red LED On" name="ron"><input class=" red" type="submit" value="Turn Red LED Off" name="roff"><br /> <br /><input class="yellow" type="submit" value="Turn Yellow LED On" name="yon"><input class="yellow" type="submit" value="Turn Yellow LED Off" name="yoff"><br /> <br /><input class="green" type="submit" value="Turn Green LED On" name="gon"><input class="green" type="submit" value="Turn Green LED Off" name="goff"><br /> <br /> <input class="lights" type="submit" value="Traffic Lights On" name="tlstart"><input class="lights" type="submit" value="Traffic Lights Off" name="tlstop"></form></center>
And here is the php code
<?phpshell_exec("gpio -g mode 17 out");shell_exec("gpio -g mode 22 out");shell_exec("gpio -g mode 27 out");$ok = 1;if(isset($_GET['roff'])) { shell_exec("gpio -g write 17 0"); } else if(isset($_GET['ron'])) { shell_exec("gpio -g write 17 1");}else if(isset($_GET['yon'])){ shell_exec("gpio -g write 27 1");}else if(isset($_GET['yoff'])){ shell_exec("gpio -g write 27 0");}else if(isset($_GET['gon'])){ shell_exec("gpio -g write 22 1");}else if(isset($_GET['goff'])){ shell_exec("gpio -g write 22 0");}else if(isset($_GET['tlstart'])){ while($ok == 1) { shell_exec("gpio -g write 17 1"); sleep(2); shell_exec("gpio -g write 17 0"); shell_exec("gpio -g write 27 1"); sleep(2); shell_exec("gpio -g write 27 0"); shell_exec("gpio -g write 22 1"); sleep(2); shell_exec("gpio -g write 22 0"); if(isset($_GET['tlstop'])) { $ok = 0; } } shell_exec("gpio -g write 17 0"); shell_exec("gpio -g write 27 0"); shell_exec("gpio -g write 22 0");}?></body></html
How to get raspi-config on Ubuntu 20.04
Is using raspi-config on Ubuntu an anti-pattern or there's an equivalent package made just for Ubuntu?
I'd like to use it to easily control OverlayFS for example. Is this possible with Ubuntu on RPi 4?
Is there such a thing as a HD 8 inch screen that's compatible with the rpi?
This is for a puzzlebox project. We want a smallish screen, about 8 inches but we want it to be HD and high performance and ideally affordable (less than £100). It doesn't need to be touchscreen but if it is that's ok too.
Does such a thing exist? All my searches come back with lower resolutions than HD.
The puzzlebox is sci fi themed and we want the screen to be super crispy, vibrant and smooth. Thanks!
Raspbian ssh: kex_exchange_identification: read: Connection reset by peer
Just copied over a fresh image of raspbian buster lite with an additional ssh file in the boot partition.
When trying ssh though I'm running into troubles:
ssh raspberrypiThe authenticity of host 'raspberrypi (***)' can't be established.ECDSA key fingerprint is SHA256:Tbh4r0cgCBP2L7Gtu93Q+ql90rwSwQZXw//gER/w+Qw.Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added 'raspberrypi,***' (ECDSA) to the list of known hosts.daniel@raspberrypi's password: ~ ssh pi@raspberrypipi@raspberrypi's password: Connection to raspberrypi closed by remote host.Connection to raspberrypi closed. ~ ssh pi@raspberrypikex_exchange_identification: read: Connection reset by peer
Verbose mode is not much more helpful either:
OpenSSH_8.2p1, OpenSSL 1.1.1g 21 Apr 2020debug1: Reading configuration data /home/daniel/.ssh/configdebug1: Reading configuration data /etc/ssh/ssh_configdebug2: resolving "raspberrypi" port 22debug2: ssh_connect_directdebug1: Connecting to raspberrypi [fd0e:94f0:31df::abd] port 22.debug1: Connection established.debug1: identity file /home/daniel/.ssh/id_rsa type 0debug1: identity file /home/daniel/.ssh/id_rsa-cert type -1debug1: identity file /home/daniel/.ssh/id_dsa type -1debug1: identity file /home/daniel/.ssh/id_dsa-cert type -1debug1: identity file /home/daniel/.ssh/id_ecdsa type -1debug1: identity file /home/daniel/.ssh/id_ecdsa-cert type -1debug1: identity file /home/daniel/.ssh/id_ecdsa_sk type -1debug1: identity file /home/daniel/.ssh/id_ecdsa_sk-cert type -1debug1: identity file /home/daniel/.ssh/id_ed25519 type -1debug1: identity file /home/daniel/.ssh/id_ed25519-cert type -1debug1: identity file /home/daniel/.ssh/id_ed25519_sk type -1debug1: identity file /home/daniel/.ssh/id_ed25519_sk-cert type -1debug1: identity file /home/daniel/.ssh/id_xmss type -1debug1: identity file /home/daniel/.ssh/id_xmss-cert type -1debug1: Local version string SSH-2.0-OpenSSH_8.2kex_exchange_identification: read: Connection reset by peer
Whats going wrong here?