在PPC上测试发不出去,这是怎么回事?
//代码片段,//以下语句实现按确定键后发送消息,帮忙看看有什么错!
case ST_INFO_VALIDATE://还款信息确认
NetProcess net = new NetProcess();//NetProcess见下面
net.setMessageText("要发送的消息");//设置要发送的消息
Thread t = new Thread(new ThreadStart(net.Run));//起线程发送
t.Start();
//NetProcess类:
class NetProcess
{
TcpClient client;
NetworkStream stream;
string IP = "220.248.36.5"; //socket://220.248.36.5
int port = 6000;
string s;
public NetProcess()
{
}
public void Connect()
{
client = new TcpClient();
try
{
client.Connect(IP, port);
text = "连接服务器成功!";
}
catch (Exception e)
{
isFail = true;
text = "连接失败!" + e.ToString();
}
}
public void WriteData(string data)
{
Byte[] mybytes = Encoding.ASCII.GetBytes(data);
stream = client.GetStream();
stream.Write(mybytes, 0, mybytes.Length);
}
public void setMessageText(string s)
{
this.s = s;
}
public void Run()
{
Connect();
WriteData(s);
}
}
在PPC上测试发不出去,说:
连接服务器失败!
无法显示错误消息,原因是无法找到包含此错误消息的可选资源程序集
检测socket.Connected一直是false
这是怎么回事?
[[it] 本帖最后由 gundumw100 于 2008-2-3 16:07 编辑 [/it]]