Home/Support/Support Forum/bind() command Syntax
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

bind() command Syntax

0 votes
Hi All,

I am new to Python. I try to run the sample python ZigBee scripts on a Digi gateway and have run into issues. All the sample programs which uses bind() fails with "Invalid Argument". Looks like even the published Digi documentation does not discuss the syntax of bind(). Will any of you able to help he towards the right direction
asked Mar 10, 2008 in Python by primeshp New to the Community (1 point)

Please log in or register to answer this question.

3 Answers

0 votes
The most common "Invalid Argument" failure in conjunction with "bind" is an attempt to re-use a "port" that is already in use.

If you are attempting to execute scripts interactively via the Digi CLI, please determine whether other Python scripts are already running. The Digi CLI "who" command can be used to query the system for active Python scripts.

It is often the case that there is a script automatically running at startup that is "consuming" the port you wish to bind to. Examining the "set python" information in the CLI could be helpful as well.
answered Mar 10, 2008 by 52637p Community Contributor (59 points)
0 votes
Thank you. Yes it was due to a autostart script zb_tcp_serial.py which is coming default with the gateway. It seems like it has already bind with the "port"
answered Mar 11, 2008 by primeshp New to the Community (1 point)
0 votes
I'm getting the bind error quite frequently on the ConnectPortX2 when executing the following code snippet
[pre]
self.socket = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)
self.socket.bind(("", 0xe8, 0, 0))

[...]

#> python monitor.py
Traceback (most recent call last):
File "<string>", line 474, in ?
File "<string>", line 262, in __init__
File "<string>", line 1, in bind
socket.error: (22, 'Invalid argument')
[/pre]

I'm confident that nothing else is running, for example, here's the CLI 'who' output immediately after getting the above bind error:
[pre]
#> who

ID From To Protocol Sessions
--



1 10.0.70.6 local shell telnet
[/pre]

Bizarrely, if I run the program 2 or 3 times in a row, it will frequently work fine after initially throwing the socket error.

Any ideas? This is preventing my code from starting reliably in "run on boot" mode (currently deactivated).
answered Jun 15, 2008 by futnuh New to the Community (14 points)
...