今日、Windows モバイル プログラミングを開始し、サーバーに正常に接続しました。
私が Visual Studio で作成しているアプリケーションはユニバーサル アプリケーションではなく、Windows Mobile アプリケーションです。
API DataWriter
は、データを出力ストリームに書き込むために使用されます。アプリケーション シナリオでは、出力ストリームはソケットです。いいえ:
DataWriter dw = new DataWriter(clientSocket.OutputStream);
私が調べてきたメソッドの 1 つはWriteBytes
and WriteBuffer
(Documentation はDataWriter の API ドキュメントについて彼女を見つけることができます
。
使用する方法とその理由 上記の方法を使用して、このクラスを変換してサーバーに送信するにはどうすればよいですか。
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