| Reply | « Previous Thread | Next Thread » |
|
Hi ppl, im having a little problem with the socket in python... hope u can help me
I have a piece of code where i use the .connect method for connecting at my pc from phone... i exchange some data and bla bla bla and the i'll call the .close() method of the socket... the problem is that the connection is still open... the only way to close the connection is close my app. Can u resolve this issue? tnks in advance! |
|
Are you using Bluetooth or TCP/IP? What kind of data exchange do you do? Plain send and recv?
|
|
Hi men, this is the code for my software... i think this is correct... :P let me know where is the error... Also, if u know, tell me how to remove that damn popup with the connection name when i use the .connect method! tnks!
..server="test.test.org" ..porta=5556 ..sock=socket(AF_INET,SOCK_STREAM) ..sock.connect((server,porta)) ..risultato="TEST" ..sock.send(risultato) ..Buffer="" ..Ch = sock.recv(1) ..while(Ch !='/'): ....Buffer+=Ch ....Ch = sock.recv(1) ....sock.close() |
|
man, im waiting for a reply.......
|
|
Verified that the network connection stays open until the application exits. Possibility to close the network connection filed as enhancement request, id 246.
|
|
Quote:
|
|
EDIT: Added fixed version of this module.
As I've understood, it is not possible to pre-connect to internet access point in a way that s60/python sockets would re-use that connection. S60/python will always display the internet access point dialog. However, it is possible to implement your own socket. It is not pretty, nor perfect, but it gets the job done. Here it is: iapconnect - tcp/ip socket for s60/python that enables automatic connection to specified internet access point. This horrible kludge works only with 2nd ed. or later phones (6600>=). Tested only with 7610. Download: http://pymbian.sourceforge.net/misc/iap-v0.20051006.zip Example: Code:
import e32
import urllib
import iapconnect
# return value 0 means that user canceled
default_iap = iapconnect.iap_selection_dialog()
conn = iapconnect.Connection()
conn.connect(u"www.google.com", 80, default_iap)
print "connected.."
conn.send("GET / HTTP/1.0\n\n")
print "sent request"
buf = []
while 1:
data = conn.recv(1024)
print data
if not data:
break
buf.append(data)
buf = ''.join(buf)
appuifw.note(unicode(buf[:100]), 'info')
#conn.close() # this will disconnect, but leave gprs active
conn.stop() # this will shutdown the gprs connection
Last edited by simo.salminen : 2005-10-06 at 22:20.
|
| simo.salminen |
| View Public Profile |
| Find all posts by simo.salminen |
|
Quote:
thanks! ![]() |
|
Hi jiveright and welcome to Nokia Forum,
You just posted a question on the Python part of the forum. You better try on the Java one, you'll get more chances for an answer. LFD Devices: Nokia E61 3rd Edition - pys60 1.4.0 Tips and modules: http://www.lfdm.net/thesis |
|
jiveright, you mailed me a question but your FN profile doesn't permit me to send you mail.
|
|
Quote:
|
|
Quote:
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Close HTTP Connection bug ??? | cars2004 | Mobile Java General | 11 | 2006-08-26 02:35 |
| Close HTTp Connection in N6230i | cars2004 | Mobile Java General | 1 | 2005-06-24 11:46 |
| Close HTTp Connection in N6230i | cars2004 | Mobile Java Networking & Messaging & Security | 0 | 2005-06-24 10:29 |
| MMS Interruption during GPRS connection hangs the device? | alexhong | Mobile Java Networking & Messaging & Security | 0 | 2004-08-31 19:47 |
| MMS Interruption during GPRS connection hangs the device? | alexhong | Mobile Java General | 0 | 2004-08-31 19:45 |