mobile和wince的tcp通信处理有区别吗?

water77731 water77731 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面的代码在wince上运行能够正常的向PC服务端发送数据,在Mobile上运行时,虽然socket能够连接到服务器,但是发送的数据服务器接收不到。请诸位高手帮忙看看什么地方出了问题。

private static void send(SocketFlags f)
{
try
{
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
IPAddress ip = IPAddress.Parse("192.168.0.200");
IPEndPoint iep = new IPEndPoint(ip, 20000);
socket.Blocking = true;
//socket.SocketType = SocketType.Stream;
socket.Connect(iep);
int c = 0;
if (socket.Connected)
{
byte[] b;
string str;
str = f.ToString();
b = Encoding.Default.GetBytes(str);
c=socket.Send(b).ToString();
socket.Close();
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
...全文
评论 19
收藏 已收藏
分享
返回顶部