reggie4
Posts: 81
Joined: Wed Jan 15, 2014 2:09 pm

Stream from PI problem

Wed Jun 24, 2015 10:04 am

a) I have a Streaming Server and motion detection python script working on my windows laptop. I can access the stream via a web browser on the same local network.

b) I move the script to my PI (fixed local network address 192.168.1.61)
c) I then SSH to the PI from my windows PC and run the script (which runs ok and the motion side of the script works)

d) I then try and access the stream, from my laptop, using my localhoast address (192.168.1.16:port number) but when I try and access it i cannot see the stream, and get the following error on my pi:

Code: Select all

my laptop ip address - - [23/Jun/2015 13:04:34] "GET / HTTP/1.1" 200 -
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/src/scripts/areadetect_movie__33.py", line 300, in server
    server = HTTPServer(('',port),CamHandler)
  File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use
e) I'm SSH'ing to the headless PI on the IP address 192.168.1.61 from the laptop.

f)

Code: Select all

netstats
gives:

Code: Select all

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.1.61:ssh        mylaptopipaddress:50851       ESTABLISHED
tcp        0    304 192.168.1.61:ssh        mylaptopipaddress:50886       ESTABLISHED
tcp        1      0 192.168.1.61:56120      externalipaddress:https     CLOSE_WAIT
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  6      [ ]         DGRAM                    6279     /dev/log
unix  2      [ ]         DGRAM                    6290     /var/run/thd.socket
unix  3      [ ]         DGRAM                    5535     /var/run/wpa_supplicant/wlan0
unix  2      [ ]         DGRAM                    5693     /tmp/wpa_ctrl_1765-1
unix  2      [ ]         DGRAM                    7102
unix  2      [ ]         DGRAM                    6848
unix  3      [ ]         STREAM     CONNECTED     7136     /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     7113     /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     6852
unix  3      [ ]         STREAM     CONNECTED     7112
unix  3      [ ]         STREAM     CONNECTED     7135
unix  3      [ ]         DGRAM                    3833
unix  3      [ ]         STREAM     CONNECTED     7302     /var/run/dbus/system_bus_socket
unix  2      [ ]         DGRAM                    6446
unix  3      [ ]         STREAM     CONNECTED     7159     /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     7301
unix  2      [ ]         DGRAM                    6670
unix  3      [ ]         STREAM     CONNECTED     7155
unix  3      [ ]         STREAM     CONNECTED     6357
unix  3      [ ]         STREAM     CONNECTED     7298     /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     6356
unix  3      [ ]         STREAM     CONNECTED     6851
unix  3      [ ]         DGRAM                    3834
unix  3      [ ]         STREAM     CONNECTED     7297

g) I don't think it's a conflict in ports/or IP addresses because this script works on my PI when I access the server via a web browser on my laptop, on the same network:

Code: Select all

#!/usr/bin/python
import SimpleHTTPServer
import SocketServer

PORT = 1991

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print ("serving at port", PORT)
httpd.serve_forever()



1) Why does the stream part of the script work on my windows laptop and not on my pi?

Return to “Beginners”