Cannot connect to tcp server on PC running AciveSync.

E

Emil Steen

I've tried these examples (standard synchronous socket tcp
communication) to communicate between the pda and windows server:
http://msdn2.microsoft.com/en-us/library/kb5kfec7.aspx
http://msdn2.microsoft.com/en-us/library/6y0e13d3.aspx

The examples works flawlessly when connecting between two PCs.
But when I try to run the client on the PDA connecting to the PC running
ActiveSync (with USB), I get SocketException. (10054: "An existing
connection was forcibly closed by the remote host".)

Connecting to another PC in the network is no problem (connecting the
PDA directly to the network or via ActiveSync, both work).


Hope that anyone has some suggestions.
Emil Steen
 
C

chris-s

From my experience, you get the 'forcibly closed' message when another
application is already using the same port number that you are trying
to use. What can happen if your applications aren't fully closing ports
when exiting, say during development, is that the port it was using
remains 'locked' often requiring a re-boot.

Hope this helps

Chris
 
E

Emil Steen

I've been using 192.168.1.91. ;-)

No, seriously. The pda is connecting to the normal IP adress of the
computer running ActiveSync. Which it get from
"Dns.GetHostEntry(servername)".

/Emil


What IP address are you using?
-- Chris Tacke OpenNETCF Consulting Managed Code in the Embedded World
 
E

Emil Steen

Hi, and thank you for your answer.
But I don't think that is the problem since right after the faulty
connection i can connect to/from other computers from/to both pda and
windows PC running ActiveSync.

/Emil
 
G

Guest

I believe it may have to do with the fact that ActieSync is doing a
passthrough, which is not full ethernet, not everything is routed. Try
using ppp_peer as the hostname (192.168.55.100 or .101 IIRC) and see what
happens.
 
E

Emil Steen

Hi again Chris,
Thank you for the suggestion!

I've already tried to connect to the server as ppp_peer (not realizing I
got another IP for the host). Now I've also tried the ip address. But
still no luck.
The strange thing is that I can connect to tcp sockets on other PCs in
the network when the pda is connected with ActiveSync and USB (just not
the ActiveSync host)...

Found another thread (searching internet) with exactly the same problem
(from jan 11 2007):
http://aspalliance.com/groups/micro...necting_to_Desktop_Socket_via_ActiveSync.aspx
But that is also unsolved....

/Emil
 
P

Paul G. Tobey [eMVP]

This sounds like a firewall problem on the PC running AS or the program
running on that PC binding its server socket, not to any of the available
networks, but to the specific wired one. That is, the server program binds
the socket to a given IP and only connection attempts on that network will
work. Other PCs will be connected to from the PPC device because, by the
time they see the connection attempt, it looks like it's coming from the AS
PC, not from the PPC, so the connecting IP is fine. On the AS PC, however,
the incoming connection is *not* from the Ethernet (or whatever), network,
so there's no program listening...

Paul T.
 
E

Emil Steen

Thank you Paul!

You helped me find the right track...!
It was the binding that was the problem. When binding the server to
127.0.0.1 it works! And then the client can connect to <servername> or
"ppp_peer" or whatever...

This has kept me awake for a few nights... Time to sleep.

Thanks again!
/Emil
 
P

Paul G. Tobey [eMVP]

Don't bind it to a specific IP at all. That just reduces the flexibility of
your server. Specify IPAddress.Any as the first parameter when creating
your IPEndPoint to bind to.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top