Can the emulator open a tcp socket to the host?

  • Thread starter Yechezkal Gutfreund
  • Start date
Y

Yechezkal Gutfreund

I am running VS2003. I have a C# console project that is accepting
socket connections. I have a C# console client that can connect to it (TCP,
port 1613).

However, when move the same code to a Compact Framework project (the client
that is, of course).
and try to use the emulator to connect to the accepting program, I get a
message about
the server actively rejecting the connection.

All IP addresses are hard coded:

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());
}
}
 
A

Alex Feinman [MVP]

What happens if instead of
OrchSock = new TcpClient(OrchHost, OrchPort);
you try
OrchSock = new TcpClient(new IPEndPoint(IPAddress.Parse(OrchHost),
OrchPort));
?
 
Y

Yechezkal Gutfreund

Yea, I tried that one too. Same effect.


Alex Feinman said:
What happens if instead of
OrchSock = new TcpClient(OrchHost, OrchPort);
you try
OrchSock = new TcpClient(new IPEndPoint(IPAddress.Parse(OrchHost),
OrchPort));
?

Yechezkal Gutfreund said:
I am running VS2003. I have a C# console project that is accepting
socket connections. I have a C# console client that can connect to it (TCP,
port 1613).

However, when move the same code to a Compact Framework project (the client
that is, of course).
and try to use the emulator to connect to the accepting program, I get a
message about
the server actively rejecting the connection.

All IP addresses are hard coded:

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());
}
}
 
A

Alex Feinman [MVP]

I've noticed you are using IP address "192.168.1.50". That would be the
virtual address of the PPP_PEER. Does the problem still occur when you use
the real IP address of your desktop?

Yechezkal Gutfreund said:
Yea, I tried that one too. Same effect.


Alex Feinman said:
What happens if instead of
OrchSock = new TcpClient(OrchHost, OrchPort);
you try
OrchSock = new TcpClient(new IPEndPoint(IPAddress.Parse(OrchHost),
OrchPort));
?

Yechezkal Gutfreund said:
I am running VS2003. I have a C# console project that is accepting
socket connections. I have a C# console client that can connect to it (TCP,
port 1613).

However, when move the same code to a Compact Framework project (the client
that is, of course).
and try to use the emulator to connect to the accepting program, I get a
message about
the server actively rejecting the connection.

All IP addresses are hard coded:

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());
}
}
 
Y

Yechezkal Gutfreund

Neil Enns said:
Have you made sure to configure your emulator to access the Internet? Are
you able to browse to a web page using Pocket IE?

(I hope you don't mind me answering out of order)

2. With the Ipaq, I can use PIE to get to the internet, I can also use a
Flash App that I
created that opens up the TCP/IP socket of the thinkpad server app. The
problem is
restricted to trying to do the same think with the DotNet CF client app that
I want
to use to replace the Macromedia Flash communication portion.

BTW: The ipaq has pocket hosts, so I assume that is why I can easily see the
thinkpad.

1. Ahah! I had not seen anything about configuring the emulator. Can you
point
me to where I need to do this?
 
Y

Yechezkal Gutfreund

Alex Feinman said:
I've noticed you are using IP address "192.168.1.50". That would be the
virtual address of the PPP_PEER. Does the problem still occur when you use
the real IP address of your desktop?

The configuration I have is simple. A linsys WiFi router. A thinkpad and an
Ipaq both
working in infrastructure mode and connected to the WiFi. PIE and IE apps
work from
both devices.

I am using static IP addresses (since sometimes I go out on the road and
need to use
ad-hoc mode). So the thinkpad has a fixed IP of 192.168.1.50 and the ipaq
192.168.1.60

Ipaq has pocket hosts and a translation for the thinkpads (chochma) name.

Besides, I have apps I wrote in Flash that open tcp/ip sockets to the
thinkpad. It is
only now when I am trying to move this to C# CF that I am having trouble. So
I expect
some sort of configuration problem is the heart of this.
 
Top