You Are Here:

Community: Developer Discussion Boards

#1 Old Mobile http/ftp server - 2007-05-08, 15:22

Join Date: Oct 2006
Posts: 10
luke14free
Offline
Registered User
Hi, I have tried many and many times to adapt the pc socket.py and similar modules to pys60 but i failed all the times...I need to create a server (better if ftp) on my phone. I'd have 3 question for you:

1)How to get current device ip for the server?(socket.py doesn't seem to work)
2)How to create an ftp/http server on my phone?
3)If isn't possible yet to create ftp/http servers on phones, do you think that there is another possibility to send data from device to device (not sms of course ) or from pc to device-device to pc by web/wap?

Thanks a lot
Reply With Quote

#2 Old Thumbs up Re: Mobile http/ftp server - 2007-05-09, 15:42

Join Date: May 2007
Posts: 6
asteroidm
Offline
Registered User
dude..,

i think "racoon" webserver is the answer to all your queries.. []
Reply With Quote

#3 Old Bug? - 2007-05-09, 17:39

Join Date: Oct 2006
Posts: 10
luke14free
Offline
Registered User
Hmm...I am trying to use a socket module to create a self server...
Code:
import socket
S = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
S.bind ( ( 'localhost', 80 ) )
S.listen ( 1 )
while True:
   channel, details = S.accept()
   print 'Connected with', details
   print channel.recv ( 100 )
   channel.send ( 'Server online' )
   channel.close()
This code should be good because it works on my pc but on the phone i get this error:
Code:
Traceback (most recent call last):
  File "<console>", line 1 in ?
  File "<string>", line 1 in bind
error: (22, 'Invalid argument')
Why??
Is it a bug? Where could I find s60 socket docs?

Kind Regards,
Luke14free
Reply With Quote

#4 Old Re: Mobile http/ftp server - 2007-05-09, 21:33

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi luke14free,

Socket doc is here http://www.python.org/doc/2.2.2/lib/lib.html

Check raccon, this is a Apache webserver for Symbian. You might be interested, it depends what you want to do.

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#5 Old Re: Mobile http/ftp server - 2007-05-10, 08:21

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi luke14free,

Little erratum: check also section 8.2 (S60 extensions to standard socket module) of the PyS60 documentation http://switch.dl.sourceforge.net/sou...doc_1_3_21.pdf

Cheers,

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#6 Old Re: Mobile http/ftp server - 2007-05-10, 13:25

Join Date: Feb 2005
Posts: 35
janimr
Offline
Registered User
luke14free,
Code:
S.bind ( ( 'localhost', 80 ) )
or '127.0.0.1' won't work. You have to use correct interface IP address instead of localhost.

- janimr
Reply With Quote

#7 Old Re: Mobile http/ftp server - 2007-05-11, 16:56

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Quote:
Originally Posted by luke14free
Hi, I have tried many and many times to adapt the pc socket.py and similar modules to pys60 but i failed all the times...I need to create a server (better if ftp) on my phone. I'd have 3 question for you:

1)How to get current device ip for the server?(socket.py doesn't seem to work)
2)How to create an ftp/http server on my phone?
3)If isn't possible yet to create ftp/http servers on phones, do you think that there is another possibility to send data from device to device (not sms of course ) or from pc to device-device to pc by web/wap?

Thanks a lot
The new 1.3.22 release will include a way to obtain the IP address associated with a given access point. However, this will not do you any good with cellular access points, in practice you can only use this over WLAN, since most operators block incoming TCP. If you know of exceptions then please let us know.

-Jukka
Reply With Quote

#8 Old Is there any way to find out the current ip? - 2007-08-31, 12:55

Join Date: Aug 2007
Posts: 1
.iqqmuT
Offline
Registered User
I want to create a TCP/IP server into my phone using WLAN in my private network. Is there any way to find out the current ip?

This is from python documentations:

Quote:
If you want to know the current machine's IP address, you may want to use gethostbyname(gethostname()).
http://docs.python.org/lib/module-socket.html

My phone returns string with asterisks, like '****************'.
Well, this wasn't surprise because in Release Notes of PyS60 it states:

Quote:
Known issues ...

1446351 227: socket.gethostbyname('localhost') inconsistencies

- This call returns inconsistent results on different S60 platforms
and depending on the state, and should not be relied on.
http://sourceforge.net/project/shown...roup_id=154155

Is there any other way to find out my IP?

This works if my IP is for example 172.16.0.23:

Code:
import socket
S = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
S.bind ( ( '172.16.0.23', 2000 ) )
S.listen ( 1 )
channel, details = S.accept()
print 'Connected with', details
print channel.recv ( 100 )
channel.send ( 'Server online' )
channel.close()
Of course I could create a simple TCP/IP service which returns back the IP of the client and use it from the phone before starting the server but it requires having this server installed into the network.
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
Push MMS from server to mobile!!!! bandana General Messaging 0 2006-03-01 20:40
run servlet on unix server using nokia mobile sohilpatel Mobile Java Networking & Messaging & Security 3 2005-03-30 18:16
Nokia Mobile Server Services SDK cdallend Mobile Java Tools & SDKs 0 2003-09-23 20:55
Licensing of Nokia Mobile Server Services API and Library 1.2 austenuk Mobile Java Tools & SDKs 0 2003-07-21 18:15
bug in nokia mobile server services... sridhar_ratna General Messaging 0 2003-05-26 05:19

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