Archived:How to close an active GPRS Connection
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Article
Keywords: socket
Translated:
By gaba88
Last edited: hamishwillee
(08 May 2013)
Introduction
The small code snippet below shows how to stop an active GPRS connection manually. This is a very useful code snippet when we are developing applications related to networking in Category:PySymbian. The access point (access_point) object of the socket module mainly serves three purposes:
- We can know the phones Archived:How to get phone IP address using PySymbian.
- We can start a GPRS connection and select a default Archived:Handling access points in PySymbian.
- We can stop or disconnect manually an active GPRS connection. The Code for this function is given below:
Code Snippet
#imports the Module (Python 1.4.5)
import socket
from appuifw import *
def sel_access_point():
""" Select and return the access point or None (error)
"""
aps = socket.access_points()
if not aps:
note(u"No access points available","error")
return None
ap_labels = map(lambda x: x['name'], aps)
item = popup_menu(ap_labels,u"Access points:")
if item is None:
return None
apo = socket.access_point(aps[item]['iapid'])
return apo
ap = sel_access_point()
if ap:
ap.start() # start an GPRS connection
print "IP:", ap.ip()
ap.stop() # stops an GPRS connection


Vikramraj4ever - How to close an active GPRS Connection by python
This do not work, when gprs active or download active.
Manually we can disconnect active gprs.vikramraj4ever 04:48, 14 January 2012 (EET)