×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Socket-server in Python

    Hello,

    I am trying to develop a socket-server in Python that will allow J2ME to send information via packets to python to allow two different languages to communicate to each other on the same phone.

    I am wondering if it is possible to listen for a socket connection in Python? I know this has been done in Symbian and i've already implemented it in J2ME (Socket server/client) running on the same phone and i'm trying to repeat it for Python.

    If anyone would have any tips that would be brilliant

  2. #2
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    295

    Re: Socket-server in Python


  3. #3
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: Socket-server in Python

    Right so here's what I have

    import socket
    ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ss.bind(('127.0.0.1',9000))
    ss.listen(5)

    while True:
    print u"Waiting for connection"
    (cs, add) = ss.accept()
    print u"Socket accepted"
    cs.close()


    So I run this script on the interpreter, press the Red phone key (or whatever to minimize it).. try to run a J2me app to connect to localhost port 9000 but nothing happens.. any ideas?

  4. #4
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: Socket-server in Python

    Well if anyone is interested, J2ME and PYTHON CAN talk..
    I was just being abit daft and in J2ME had Connector.open("socket://localhost..").. when infact I should've used Connector.open("socket://127.0.0.1..")

    So good luck to anyone else who tries this and i'm open to anyone at all interested and collaborating on this

    -Rexicle-ster!!

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: Socket-server in Python

    Hi Rexwal,

    although it is just two years ago I hope you are still watching this thread.

    You wrote:
    and i've already implemented it in J2ME (Socket server/client) running on the same phone a
    Would you mind to give me a clue, how you did that? I can do what I want, but the line

    ServerSocket = (ServerSocketConnection) Connector.open("socket://127.0.0.1:5000");

    excepts with error -34 (cannot connect) in S60 3rd FP 1 environment.

    ServerSocket = (ServerSocketConnection) Connector.open("socket://:5000");

    works, but I would like to have the server at localhost.

    Regards

Similar Threads

  1. Problem socket server in my nokia phone ....
    By kajinka13 in forum Symbian
    Replies: 0
    Last Post: 2006-01-06, 17:59
  2. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  3. Socket problem
    By defragger in forum Symbian
    Replies: 0
    Last Post: 2005-08-25, 08:16
  4. socket server application using Series 60 SDK
    By irohit in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-09-16, 05:27

Posting Permissions

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