You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy Socket problem - 2005-08-09, 16:29

Join Date: Jul 2005
Posts: 17
Location: Munich, Germany
Send a message via ICQ to max2k5
max2k5
Offline
Registered User
Whenever I open a listening socket (tcp and udp) on the phone (6670, 1.1.6), all incoming connections are shown to be from 0.8.0.0, regardless of the real IP, where the connection/datagram is coming from (tested with different IP addresses, 10.0.0.X). I can see this behaviour with accept() and with recfrom().
Nevertheless, the socket is shown correctly.

Thanks,
max
Reply With Quote

#2 Old 2005-08-10, 09:06

Join Date: May 2003
Posts: 96
mikfi
Offline
Regular Contributor
Hi,

the fact that you get 0.8.0.0 is because the mobile phone doesn't have a real IP address.
Therefore the accept() method is intended to be used only internally, for IPC.

You may want to look at this thread:
http://discussion.forum.nokia.com/fo...threadid=59484

-mik
Reply With Quote

#3 Old 2005-08-10, 10:17

Join Date: Jul 2005
Posts: 17
Location: Munich, Germany
Send a message via ICQ to max2k5
max2k5
Offline
Registered User
Hi,

but how does it come, that
>>> gethostbyname(gethostname))
shows my real IP address, the phone got from ppp? (10.0.0.101)
Reply With Quote

#4 Old 2005-08-11, 13:22

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Quote:
Originally posted by max2k5
Hi,

but how does it come, that
>>> gethostbyname(gethostname))
shows my real IP address, the phone got from ppp? (10.0.0.101)
You mean gethostbyname(gethostname()) ?
I can't replicate that on a 6630. Note that gethostname() is currently just a stub hardcoded to return 'localhost'.
Reply With Quote

#5 Old 2005-08-11, 16:27

Join Date: Jul 2005
Posts: 17
Location: Munich, Germany
Send a message via ICQ to max2k5
max2k5
Offline
Registered User
yes, i mean gethostbyname(gethostname())-but results are really the same with localhost.

all i did within python was:
>>> from socket import *
>>> gethostbyname('localhost')

these are the different outputs i can see:
- '0.0.0.0', when not connected at all
- '10.129.X.Y', connected via GPRS
- '10.0.0.101', connected via Bluetooth to my desktop

So the access to the underlying symbian IP part works, I guess. Just the peername of a socket makes this 0.8.0.0 problem.
Reply With Quote

#6 Old 2005-08-16, 16:11

Join Date: Jul 2005
Posts: 17
Location: Munich, Germany
Send a message via ICQ to max2k5
max2k5
Offline
Registered User
Okay, here is exactly what I do:

phone:
>>> from socket import *
>>> HOST = '10.0.0.101'
>>> PORT = 50007
>>> gethostbyname('www.google.com')
'66.249.93.99'
>>> s = socket(AF_INET, SOCK_STREAM)
>>> s.bind((HOST, PORT))
>>> s.listen(1)
>>> conn, addr = s.accept()
>>> print 'Connected by', addr
Connected by ('0.8.0.0', 54322)
>>> while 1:
>>> data = conn.recv(1024)
>>> if not data: break
>>> conn.send(data)
>>> conn.close()

desktop:
>>> from socket import *
>>> HOST = '10.0.0.101'
>>> PORT = 50007
>>> s = socket(AF_INET, SOCK_STREAM)
>>> s.connect((HOST, PORT))
>>> s.send('Hello, world')
>>> data = s.recv(1024)
>>> s.close()
>>> print 'Received', repr(data)
Hello, world'
Last edited by max2k5 : 2005-08-18 at 14:57.
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

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