×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    Does socket.bind() work?

    Hi,
    I get
    error: (0, 'Error')
    whenever I try to use socket bind to make a tcp server socket or to bind a udp socket.

    I tried the following program from the python manual. Unfortunately it doesn't get past s.bind. Any ideas on how to work around this?

    # Echo server program
    import socket

    HOST = '' # Symbolic name meaning the local host
    PORT = 50007 # Arbitrary non-privileged port
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind((HOST, PORT))
    s.listen(1)
    conn, addr = s.accept()
    print 'Connected by', addr
    while 1:
    data = conn.recv(1024)
    if not data: break
    conn.send(data)
    conn.close()

    Error i get is
    s.bind((HOST, PORT))
    Traceback (most recent call last):
    File "<console>", line 1, in ?
    File "<string>", line 1, in bind
    error: (0, 'Error')


    Thanks for any suggestings. I just installed PythonForSeries60_pre_SDK20.SIS on my ngage qd.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    12
    try with HOST="localhost" or "127.0.0.1"

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    Definite bug

    I changed the HOST to "localhost", same problem.
    Then I changed it to 127.0.0.1, suddenly it no longer crashed. However one can't connect to such an ip from outside world, so I had to hardcode my device ip to 10.0.0.2 and everything worked =)

    Thanks for the workaround, but this is obviously a bug. What is the proper place to report such issues?

    Thanks a lot for your suggestion.

  4. #4
    Registered User
    Join Date
    Jul 2005
    Location
    Munich, Germany
    Posts
    17

    similiar problem

    First I had the same problem as stated above, then I changed to the real local IP address (given via gnubox/BT).

    But after
    "s.bind(('10.0.0.100', 50007))"
    i get
    "socket.error: (13, 'Permission denied')"

    I thought 50007 should be an unprivileged port, accessible to all? Or is there another access system I don't know of?

    Thanks,

    Maximilian

    ps: I use version 1.1.5 on a 6670.

  5. #5
    Regular Contributor
    Join Date
    May 2003
    Posts
    96
    Hi,

    according to my understanding the mobile phone doesn't have a _real_ IP address and/or operators wouldn't allow to connect to it using that address.

    Therefore bind() and other server-side methods were implemented to be used for internal process communication.

    Of course if the underling platform will support the real binding from another device, than even Python socket.bind() should work.

    -Mik

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    4

    Re: Does socket.bind() work?

    I have been having the same problem. Anyone knows a solution to this?

    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •