Open GoogleCodeExporter opened 9 years ago
I am having issues connecting to two devices. I can connect to either one
individually, but not both at the same time. I get the IOerror, unreachable
network error. I even tried threaded methods. I am new to python, so it could
be my code.
# Robot1 (NXT1)
host1="00:16:53:12:0c:42"
# Robot2 (NXT2)
host2="00:16:53:10:8e:94"
hosts=[host1,host2]
# Can't do both connection at same time, can do either of following
#b1 = nxt.bluesock.BlueSock(host1).connect()
#b1.message_write(0, 'ONE test' )
#b2 = nxt.bluesock.BlueSock(host2).connect()
#b2.message_write(0, 'TWO test' )
class ThreadClass(threading.Thread):
def run(self):
now = datetime.datetime.now()
print "%s says Hello World at time: %s %s " % (self.getName(), now,hosts[0])
print "%s says Hello World Host: %s" % (self.getName(),hosts[i])
port=1
ser1=BluetoothSocket( RFCOMM )
ser1.connect((hosts[i], port))
ser1.settimeout(0)
print "Thread %d connected to %s" % (i,hosts[i])
#Alternate connection method using nxt-python
#b = nxt.bluesock.BlueSock(hosts[i]).connect()
#b.message_write(0, 'ONE test' )
for i in range(2):
print "Starting thread %d to connect host %s" % (i,hosts[i])
t = ThreadClass()
t.start()
time.sleep(1)
time.sleep(2)
print('Done with test!')
Original comment by ed.gat...@gmail.com
on 28 Feb 2013 at 12:35
Any update on the original issue that was posted on Sep 21, 2011?
I seem to be running into the same issue on win7, running Python 2.6, and
latest PyBluez
import bluetooth
BTSocket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
BTSocket.connect((target,12))
, where "target" is the bluetooth device address for my droid razr smartphone.
In addition to port 12, I tried with all available ports on my android phone
device as shown by bluetooth.find_service(address = addr)
Can anyone help to resolve this?
Error message:
File "C:\Python26\lib\site-packages\bluetooth\msbt.py", line 53, in connect
bt.connect (self._sockfd, addr, port)
IOError: A socket operation was attempted to an unreachable network.
Original comment by sch...@gmail.com
on 4 Oct 2013 at 11:36
Original issue reported on code.google.com by
scriptr...@gmail.com
on 21 Sep 2011 at 11:38