| Reply | « Previous Thread | Next Thread » |
|
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 |
|
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 |
|
Hi,
but how does it come, that >>> gethostbyname(gethostname)) shows my real IP address, the phone got from ppp? (10.0.0.101) |
|
Quote:
I can't replicate that on a 6630. Note that gethostname() is currently just a stub hardcoded to return 'localhost'. |
|
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. |
|
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 | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |