×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Question Sending and recving on a socket?

    Is there any way to write a telnet like application in Python for Series 60?

    I'm trying to run with the socket code in a thread as I know you can't set sockets non-blocking. However settimeout() isn't present and I can't access the same socket object from two threads (I think).

    This means that if I call recv() it will block until there is data to receive and it is the only way of finding out if there is any data to receive AFAIK. As I can't access the socket from multiple threads this means I must stop sending until I receive something which would be a problem.

    Please tell me where I am wrong, what I have missed or whether this really is impossible at the moment.

    Joseph

  2. #2
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: Sending and recving on a socket?

    Originally posted by jtl21
    Is there any way to write a telnet like application in Python for Series 60?

    I'm trying to run with the socket code in a thread as I know you can't set sockets non-blocking. However settimeout() isn't present and I can't access the same socket object from two threads (I think).

    This means that if I call recv() it will block until there is data to receive and it is the only way of finding out if there is any data to receive AFAIK. As I can't access the socket from multiple threads this means I must stop sending until I receive something which would be a problem.

    Please tell me where I am wrong, what I have missed or whether this really is impossible at the moment.

    Joseph
    Using just the normal Python socket API, that is impossible at the moment. However, the shipped socket module includes support for a non-standard API that can be used to accomplish this.

    Most socket functions can be used in asynchronous mode by giving then a callback as an extra argument. The call will return immediately and the callback is called when the operation is actually finished. It is our intention to offer the standard non-blocking socket API in the next release, but in the mean time you could use that non-standard API.

    Prototype code that implements more or less standard non-blocking sockets over that non-standard API exists already. I'll see if I could post it somewhere.

    Another choice is to use the PDIS socket module. That should have the functions you need, but that API is non-standard also.

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    17

    I need asynchronous socket very much !

    - PDIS extension is only (?) for serie 60 v2.x

    - It would be very cool if you could post the standard socket emulation layer even in beta ! Instead I will look into the non standard API...

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    2
    Thanks for that information. I can work around this issue for now but am still looking forward to the non-blocking sockets when they are available.

    Its good to know that I hadn't missed anything and aren't going mad.

    Thanks,

    Joseph

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    12

    Re: Re: Sending and recving on a socket?

    Another choice is to use the PDIS socket module. That should have the functions you need, but that API is non-standard also.
    where can i find PDIS library ?
    And an example of the use of recv method of
    non standard api ?
    (does it return the read text to the callback function ?)

    thanks.
    Last edited by sznever; 2005-05-02 at 01:06.

  6. #6
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: Re: Re: Sending and recving on a socket?

    Originally posted by sznever
    where can i find PDIS library ?
    Well, it's the first link if you google for "PDIS library".

    And an example of the use of recv method of
    non standard api ?
    (does it return the read text to the callback function ?)
    thanks.
    No examples are available, but your guess was exactly correct.

Posting Permissions

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