【发布时间】:2016-02-02 22:58:56
【问题描述】:
我今天开始windows mobile编程,并成功连接到我的服务器。
我在 Visual Studio 上制作的应用程序不是通用应用程序,而是 Windows Mobile 应用程序。
APIDataWriter用于将数据写入输出流,在应用场景中输出流是套接字。即:
DataWriter dw = new DataWriter(clientSocket.OutputStream);
我一直在研究的一种方法是WriteBytes 和WriteBuffer
(可以通过API documentation for DataWriter找到她的文档
.
我使用哪种方法,为什么? 如何使用上述方法转换此类并将其发送到我的服务器。
public class Message
{
public string pas { get; internal set; }
public int type { get; internal set; }
public string us { get; internal set; }#
}
//the below code goes in a seperate function
DataWriter dw = new DataWriter(clientSocket.OutputStream);
Message ms = new Message();
ms.type = 1;
ms.us = usernameTextBox.Text;
ms.pas = usernameTextBox.Text;
//TODO: send ms to the server
【问题讨论】:
标签: c# tcp windows-mobile windows-networking stream-socket-client