public virtual string Method { get; set; }
Public Overridable Property Method As String
Get
Set
public:
virtual property String^ Method {
String^ get ();
void set (String^ value);
}
abstract Method : string with get, set
override Method : string with get, set
For Object Exchange the method code is mapped to the equivalent HTTP style method. For example "PUT", "GET" etc. "PUT" is the default value. There is new support for GET as of version 2.5.
To use GET change the Method to "GET" and you must also use scheme "obex-ftp" in the URL instead of the usual "obex" -- unless you know that the default OBEX server you are connecting supports GET.
For a PUT sample see the class documentation. For GET, see below.
' The host part of the URI is the device address, e.g. IrDAAddress.ToString(),
' and the file part is the OBEX object name.
Dim addr As String = "112233445566"
Dim uri As New Uri("obex-ftp://" & addr & "/HelloWorld.txt")
Dim req As New ObexWebRequest(uri)
req.Method = "GET"
Dim rsp As ObexWebResponse = CType(req.GetResponse(), ObexWebResponse)
Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode)
Using content As Stream = rsp.GetResponseStream()
' Using a StreamReader to read text from the stream...
Using rdr As New StreamReader(content)
While True
Dim line As String = rdr.ReadLine()
If line Is Nothing Then Exit While
Console.WriteLine(line)
End While
End Using
End Using