You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy socket not working in StandAllone App?? - 2008-06-25, 17:10

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hello python gurus,
I do've an application which is opening a server connection on a sertain port to receive data (everything in a separat threat).
As long as I run the app from the script shell everything works perfect.

But after installing the app as an *.sis on N73 (or N95) the threat is not connecting to the server anymore, throwing an exception on "s.connect((sv_host, sv_port))".

What is wrong here? Why is it only working when getting started from the script shell but not as stand allone???
Can someone give some help on this please?
This is the relevant part of my code:
Code:
def connection_thread():
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.connect((sv_host, sv_port)) ##whats wrong here??
    except socket.error, inst:
        output = open(u"E\\Debug\\debug_thread.txt", "a")
        output.write(u"; socket.error %s\n"%str(inst) )
        output.close()
    
    while thread_running: #receive data as long as the threat is running
            rawdata_sv = s.recv(1024)
            ...bla bla bla
The exception just says: "socket.error (0, 'Error')" ????

Thx for any help
Reply With Quote

#2 Old Re: socket not working in StandAllone App?? - 2008-06-25, 20:50

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
You need the NetworkServices capability to use network sockets. The Script Shell has that capability and that's why it works OK. See the --caps option in Ensymble README.
Reply With Quote

#3 Old Re: socket not working in StandAllone App?? - 2008-06-26, 08:19

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hi @ all,
does the Script Shell has the NetworkServices capability by default?
As I did not sign my Script Shell with any capability.
Furthermore I read here that socket does not need any capabilities. I'm confused

Thx for help
novis
Reply With Quote

#4 Old Re: socket not working in StandAllone App?? - 2008-06-26, 09:30

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post
Hi @ all,
does the Script Shell has the NetworkServices capability by default?
The self-signed (non-testrange) version of the Script Shell has these capabilities by default:
  • NetworkServices
  • LocalServices
  • ReadUserData
  • WriteUserData
  • UserEnvironment


Quote:
Originally Posted by novis View Post
Furthermore I read here that socket does not need any capabilities.
To open Internet socket connections, NetworkServices is required. Bluetooth sockets need LocalServices. The PyS60 documentation does not mention this, unfortunately.
Reply With Quote

#5 Old Re: socket not working in StandAllone App?? - 2008-06-27, 09:45

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hi,
i still have no luck. Here is what I tried:
I do've an app which is using socket for bluetooth and a GPRS-connection. In the script shell it works perfect but not in a *.sis.

After jethro.fn suggestion I

1. signed the ScriptShell online with all 13 capabilities (just to be safe) and installed it on the handset

2. used ensymble with: "ensymble.py py2sis myApp.py" (without UID or certificate)

3. signed my Aplication online with all 13 capabilities and installed it on the handset

Result:
But still, when I start my application and want to connect to my Bluetooth GPS it hangs.

This can not be too dificult but I can't see my mistake.
Could you please give a hand. (I'm trying for ours now)

thx
novis
Reply With Quote

#6 Old Re: socket not working in StandAllone App?? - 2008-06-27, 13:23

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post
2. used ensymble with: "ensymble.py py2sis myApp.py" (without UID or certificate)
Open Signed Online will generate a certificate that has the capabilities you have selected, but does not modify your application to actually enable those capabilities. Therefore, you need to set the capabilities explicitly when using Ensymble:

Code:
ensymble.py py2sis --caps=Location+UserEnvironment+NetworkServices... myApp.py
You don't need a certificate at this point, just let Ensymble use the default one. The Open Signed Online process will then replace that certificate with a proper one.

Hint: To enable all 13 capabilities, you can use --caps=0xff1b4. It's less typing than listing all 13 capabilities by name.
Reply With Quote

#7 Old Re: socket not working in StandAllone App?? - 2008-06-27, 14:42

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hello jethro.fn,
thx 4 ur help, (and stupid me)!

Life can be so easy

thx
novis
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
S60 3rd ed. sample app not working on emulator vishy_ch General Symbian C++ 8 2009-09-20 21:38
Is PC Suite App necessary to get PC Connectivity SDK working? bijugk PC Suite API and PC Connectivity SDK 2 2007-08-20 10:14
symbian signed testing problem. anglina General Symbian C++ 0 2007-02-01 11:15
MS Smartphones have a WORKING EMail app! McHale General Discussion 0 2003-12-16 20:16
App. working in Emulator, but not in 7650 monastyr Mobile Java Tools & SDKs 1 2003-11-07 11:22

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia