You Are Here:

Community: Developer Discussion Boards

#1 Old TCP/IP Socket fails to connect without an error. - 2008-08-13, 14:39

Join Date: Feb 2006
Posts: 168
Location: Helsinki, Finland
RICH?
Offline
Regular Contributor
Hello,

I just got a new phone (E66). I tried to create a TCP/IP socket in python between the phone and my pc.

I am using the TCP/IP examples here: http://www.mobilenin.com/pys60/info_networking.htm

I have set the host and port variables correctly. First I start the server on the pc and then the client on the phone. The phone asks for an access point and after that nothing happens. I've tried WLAN and my operators connection and neither work. The script just hangs at "s.connect((HOST,PORT))". I see the connection icons but the socket just wont connect.

I'm running the script file from the script shell with the most recent python version installed.

Has anyone got any idea about how to get this working?

EDIT:
Actually after a long while I get a "Connection timed out" error. This still doesn't help solving the problem though.

EDIT2:
I determined the IP address of my pc from "whatismyip.com" is that the correct way to do it when the pc is connected to the net via wlan?


Nokia E66
PyS60 1.4.4 final
Last edited by RICH? : 2008-08-13 at 16:05.
Reply With Quote

#2 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 17:28

Join Date: Aug 2008
Posts: 7
tarantulae
Offline
Registered User
Hello Rich, as you saw on my other post, I have the same problem.
Have you tried to connect with Opera or other Browser like from your phone to that port on PC ? I've tried with Opera and the connection is ok, but only with python the connection hangs, it's a very strange problem.
Reply With Quote

#3 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 17:28

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by RICH? View Post
I've tried WLAN and my operators connection and neither work. The script just hangs at "s.connect((HOST,PORT))".

...

EDIT2:
I determined the IP address of my pc from "whatismyip.com" is that the correct way to do it when the pc is connected to the net via wlan?
No. You are most likely behind a home router/firewall. It assigns private IP addresses to devices behind the firewall (NAT, Network Address Translation) and uses a separate IP address for the external connection, which is the one whatismyip.com reports.

If you're using Windows, there's a command ipconfig which reports the IP address your PC is currently using. It is probably 192.168.1.10 or some such, depending on the brand of your router/firewall. Similarly Linux, OS X and other Unix-like environments have the ifconfig command. (You may need to specify the full path explicitly, for example /sbin/ifconfig, if running ifconfig from a regular user account.)

You cannot originate connections from outside the firewall, unless you have instructed the router/firewall to pass a range of ports in to a specific IP address inside the firewall (port forwarding).

So, in summary: If you're trying to connect using your phone operator, you'll need to enable port forwarding and use the external IP for connect(). If you're inside your private network through WLAN, you don't need port forwarding but need to specify the private IP address of your PC for connect().
Reply With Quote

#4 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 17:33

Join Date: Aug 2008
Posts: 7
tarantulae
Offline
Registered User
Jethro, I'm sure that the IP is correct and is ok for external connections, is my real IP and the port is listening for connections, with Opera (using the same connection of python) I can connect, but with python, I get the same problem of Rich, I think that this is a python issue.
Reply With Quote

#5 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 17:36

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by tarantulae View Post
I think that this is a python issue.
Are you using a SIS-packaged application on a 3rd Edition device? Have you enabled the NetworkServices capability with Ensymble?
Reply With Quote

#6 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 17:38

Join Date: Aug 2008
Posts: 7
tarantulae
Offline
Registered User
No man, I'm using a simple .py script running in PythonShell with all capabilities enabled.
Reply With Quote

#7 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 18:30

Join Date: Feb 2006
Posts: 168
Location: Helsinki, Finland
RICH?
Offline
Regular Contributor
Thanks for the info jethro.fn I'll check what I can try to do about it .

To be continued...


Nokia E66
PyS60 1.4.4 final
Reply With Quote

#8 Old Re: TCP/IP Socket fails to connect without an error. - 2008-08-13, 19:06

Join Date: Feb 2006
Posts: 168
Location: Helsinki, Finland
RICH?
Offline
Regular Contributor
Ok,the problem is definitely the way my wlan works, I'll see how to change the settings later.

I connected my phone to my laptop by bluetooth so that I could use the net on the pc. Then I ran the server on the laptop and the client on on the phone. They connected fine. I realize that the phone's internet connection is used for both server and client but it does the job.

To be continued...


Nokia E66
PyS60 1.4.4 final
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
Browser monitoring NevePankaj General Symbian C++ 19 2008-08-12 11:06
Error with makesis.exe and creating the .pkg file gramya87 Symbian Tools & SDKs 7 2007-10-10 14:53
Carbide.vs 2.01 Registration Problem baykal Symbian Tools & SDKs 5 2006-12-22 17:55
problem with Code Warrior 5.2 mayankkedia General Symbian C++ 4 2006-06-22 09:26
Socket Connect never returns error delipsingh Symbian Networking & Messaging 0 2005-05-14 03:08

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