mobile和wince的tcp通信处理有区别吗?
下面的代码在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);
}
}