VB.Net/Network Remote/Message Receiver — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 12:45, 26 мая 2010
Message Receiver Demo
Imports System
Imports System.IO
Imports System.Messaging
Public Class MainClass
Shared Sub Main()
Dim mQ As MessageQueue
Dim mes As Message
Dim X As String
Dim br As BinaryReader
If MessageQueue.Exists(".\Private$\HelloWorld") Then
mQ = New MessageQueue(".\Private$\HelloWorld")
Else
Console.WriteLine("Queue doesn"t exist.")
Return
End If
Try
mes = mQ.Receive(New TimeSpan(0, 0, 3))
br = New BinaryReader(mes.BodyStream)
X = New String(br.ReadChars(CType(mes.BodyStream.Length, Integer)))
Console.WriteLine("Received Message: {0}", X)
Catch
Console.WriteLine("No Message to Receive.")
End Try
End Sub
End Class