CF socket help (consultant) needed $$

  • Thread starter Thread starter Yechezkal Gutfreund
  • Start date Start date
Y

Yechezkal Gutfreund

We are stuck. We are soliciting for someone with DotNet CF TCP socket
experience.

For some reason we cannot connect from either the emulator or a PDA via TCP
to
a server-based client.

The error returned is: Server Actively Rejects connection.

Server: Win XP running C# app written with VS2003 (framework 1.1)

Client: If the client written as a command line c# application and run on
the host,
the connection occurs.

However, Emulator and PDA (via ActiveSync 3.7) do not connect.
We are using TCPClient with the host either as an IP address, or as
a dns name (with pockethosts installed on the PDA).

PDA has no trouble connecting to the host, via WiFi application written
in MM Flash that uses TCP ports. However, this is an attempt to
move the comm part of that application to a DotNet C# PDA-resident
service.

Please send your qualifications and suggestions to the hotmail address,
and we will choose the best candidate and negotiate rates.


--
==================================
Yechezkal Gutfreund
Chief Scientist
Kesser Technical Group, Inc.
==================================
 
And also which port you are using? And also what kind of
protocol (UDP/TCP...)?

-Alex

Alex Yakhnin, Microsoft Embedded MVP
IntelliProg, Inc.
http://www.intelliprog.com
"Check out our Compact Framework controls..."
 
1. The IPAQ is connected via IR connection (ActiveSync 3.7 on host). Note:
We have tried the emulator also, but with no luck.

2. We are connecting via TCP port 1613. As stated, a test client written in
C# that runs on the NET framework on the host, connects fine to the server
application. Also, We have other programs on the IPAQ that use TCP sockets
to connect to the same host (but different server programs).

3. Source is available. It is very short.
 
I have a lot of problems, connecting between an FTP client on the PDA and a
FTP Server on a host PC via ActiveSync.
First of all the connection fails if you syncronize with ActiveSync using
guest mode.
And also you have to specify the IP address directly. No DNS resolution woks
(or I didn't get it to work) over an ActiveSync connection.

Following the code I use to connect:


Protected m_clientSocket As Socket

Protected m_remoteEndPoint As IPEndPoint

m_clientSocket = New Socket(AddressFamily.Unspecified, SocketType.Stream,
ProtocolType.Tcp)

m_remoteEndPoint = New IPEndPoint(IPAddress.Parse(m_strHost), m_iPort)

m_clientSocket.Connect(m_remoteEndPoint)


m_strHost contains the IP address, for example: "192.168.1.10" and m_iPort
contains de port, for example: 1613

Hope this helps
Roberto
 
I am doing simliar things, but no luck. As I said. If someone knows this
stuff fowards/backwards. I have
consulting $$ to pay them.

public class StationMaster
{
string OrchHost = "192.168.1.50";
int OrchPort = 1613;
TcpClient OrchSock;
private NetworkStream OrchStream;
private StreamReader OrchRead;
private StreamWriter OrchWrite;
private AsyncCallback OrchCallback;
private byte[] IOBuffer;
private int IOBufferSize = 4096;
string PacketFile = "Packet.xml";
XmlDocument Xdoc = new XmlDocument();
StationMasterGUI TheGUI;

public StationMaster(StationMasterGUI gui)
{
OrchCallback = new AsyncCallback(this.onReadDone);
IOBuffer = new byte[IOBufferSize];
TheGUI = gui;
this.connect();
this.loadXml();
}
private void connect()
{
try
{
OrchSock = new TcpClient(OrchHost, OrchPort);
Tools.Debug(1, "Connected to: {0} on: {1}", OrchHost, OrchPort);
OrchStream = OrchSock.GetStream();
OrchRead = new StreamReader(OrchStream);
OrchWrite = new StreamWriter(OrchStream);
}
catch (Exception err)
{
Tools.Debug(10, "Connect to {0}:{1}:{2} failed" ,OrchHost, OrchPort,
err.ToString());
}
}
 
Yechezkal,

I have successfully connected an FTP client of my own to an FTP server, both
using pass-through and directly without problem. I did this however using
Socket classes and not TcpClient classes; but this should not make much of a
difference as the TcpClient is based upon Socket.

Your problem may not be in the client. What is the server? Is it listening
correctly on the correct port on the correct interface? ActiveSynch creates
an additional "dummy" network interface that is used for the pass-through
connections and this will not have the same IP address as your network card.

Feel free to post me the full code and I will endeavour to see what is
happening and what help I can give. If you do not wish to post publicly,
post to my email; it is real!

Cheers.


Martin Robins
Orpheus Solutions
UK.
 
I like to drill down and understand what is going on. Especially since I
have written several
TCP applications with DotNet (fairly elaborate client/server but not CF
based). And all
used TCPClient.

It seems that I accidently used a lowercase name for the host "chochma".
Now, when used
your code, it did the DNS resolve and installed a name in the local DNS
lookup. Afterwards
the lower case name worked with TCPClient constructor. However, if one does
a soft
reset and then just used the TCPClient constructor, it would not resolve.

I was working on and off on this for three days, and it was not till your
help that
I have figured this out.


Martin Robins said:
This conversation was subsequently taken off-line.

I attach however a zip file containing an example of a PPC program
connecting to a PC server. The server is threaded to accept multiple
connections and process them simultaneously. The client simply connects to
the server, but once the connection is established you can do whatever you
wish. There is however a problem with the shutdown of the listener but for
the sake of example I did not finish this part.

If anyone has any questions regarding the eample, please do not hesitate to
continue this thread.

Regards,


Martin Robins.


Martin Robins said:
Yechezkal,

I have successfully connected an FTP client of my own to an FTP server, both
using pass-through and directly without problem. I did this however using
Socket classes and not TcpClient classes; but this should not make much
of
a
difference as the TcpClient is based upon Socket.

Your problem may not be in the client. What is the server? Is it listening
correctly on the correct port on the correct interface? ActiveSynch creates
an additional "dummy" network interface that is used for the pass-through
connections and this will not have the same IP address as your network card.

Feel free to post me the full code and I will endeavour to see what is
happening and what help I can give. If you do not wish to post publicly,
post to my email; it is real!

Cheers.


Martin Robins
Orpheus Solutions
UK.


Yechezkal Gutfreund said:
I am doing simliar things, but no luck. As I said. If someone knows this
stuff fowards/backwards. I have
consulting $$ to pay them.

public class StationMaster
{
string OrchHost = "192.168.1.50";
int OrchPort = 1613;
TcpClient OrchSock;
private NetworkStream OrchStream;
private StreamReader OrchRead;
private StreamWriter OrchWrite;
private AsyncCallback OrchCallback;
private byte[] IOBuffer;
private int IOBufferSize = 4096;
string PacketFile = "Packet.xml";
XmlDocument Xdoc = new XmlDocument();
StationMasterGUI TheGUI;

public StationMaster(StationMasterGUI gui)
{
OrchCallback = new AsyncCallback(this.onReadDone);
IOBuffer = new byte[IOBufferSize];
TheGUI = gui;
this.connect();
this.loadXml();
}
private void connect()
{
try
{
OrchSock = new TcpClient(OrchHost, OrchPort);
Tools.Debug(1, "Connected to: {0} on: {1}", OrchHost, OrchPort);
OrchStream = OrchSock.GetStream();
OrchRead = new StreamReader(OrchStream);
OrchWrite = new StreamWriter(OrchStream);
}
catch (Exception err)
{
Tools.Debug(10, "Connect to {0}:{1}:{2} failed" ,OrchHost, OrchPort,
err.ToString());
}
}
 
Back
Top