Socket & bind
#1
hi, i get an socket.error 10049 - "can't assign requested address" when trying to bind a socket on the xbox:

udpsock = socket(af_inet,sock_dgram)
udpsock.bind((gethostbyname(gethostname()), htons(port)))

i've tried some a great number of values for port (80, 280, 2800, 7000) but i allways get the same error.
have also tried removing the htons without any luck?

is it possible to create a server with xbmc python?
Reply
#2
IS THIS FIXED YET? I have same issue :-(

This simple code fails...save as default.py and try to run as XBMC script

#create an INET, STREAMing socket
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#bind the socket to a public host,
# and a well-known port
serversocket.bind((socket.gethostname(), 80))
#become a server socket
serversocket.listen(5)
Reply
#3
binding to port 80 should always fail as that is used for http.. but i'm guessing you've tried other ports?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
elupus Wrote:binding to port 80 should always fail as that is used for http.. but i'm guessing you've tried other ports?

Yes, I have tried 0, 53114, and other ports. Still no good. Although, I was able to bypass the bind using '' as the IP/host, but I think it really failed without throwing an exception...
Reply
#5
was just going to post that you MUST use "" for ip/host Smile. xbox ip stack doesn't allow anything else. can add a check for it so that it defults to "" when it detects a local address.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
this has been fixed in svn now.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Socket & bind0