Message queues

D

David

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I can
call this code:

IPAddress[] addresses = Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are working
properly.

Is there something special that I have to do on the Vista-64 machine or on
the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the queue.
I'm not sure that DNS can be used to resolve the name, but the name you're
using is not being resolved with DNS, I'd bet.

Paul T.
 
S

Simon Hart [MVP]

Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
 
D

David

I tried the client side on a Vista-32 machine. The simple app only has one
line in it regarding msmq.

if (!MessageQueue.Exists(@"david-1\private$\callerid"))
{
...
}

I get an error stating the I have an invalid queue path name. What is wrong
with the path name?
 
D

David

I have replaced the david-1 with the ip address of david-1, 10.0.0.20, with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is wrong
with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OJpW%[email protected]...
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the name
you're using is not being resolved with DNS, I'd bet.

Paul T.

David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine or
on the iPAQ to make this work?
 
D

David

I have replaced the david-1 with the ip address of david-1, 10.0.0.20, with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is wrong
with my path?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
D

David

I have replaced the david-1 with the ip address of david-1, 10.0.0.20, with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is wrong
with my path?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20, with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OJpW%[email protected]...
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine or
on the iPAQ to make this work?
 
D

David

I get this error if I try that with the iPAQ:

Cannot determine whether a queue with the specified format name exists.

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
D

David

I have tried this on both the iPAQ and the Vista-32 machine:

if
(!MessageQueue.Exists(@"FormatName:DIRECT=TCP:10.0.0.20\private$\callerid"))

I get this error:

Cannot determine whether a queue with the specified format name exists


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:OJpW%[email protected]...
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine or
on the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

Hmmm. Well, that suggests that you don't have network continuity between
where you are and where the queue is or that you don't have message queue
running on the device or, maybe, on the PC. Doesn't the MSMQ for your
device come with some sort of administrative tool for checking the status,
etc.? Can you ping or otherwise verify network connectivity between the two
ends of your communication path?

Paul T.

David said:
I have tried this on both the iPAQ and the Vista-32 machine:

if
(!MessageQueue.Exists(@"FormatName:DIRECT=TCP:10.0.0.20\private$\callerid"))

I get this error:

Cannot determine whether a queue with the specified format name exists


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with the same results.

I now have a simple client on another Vista-32 machine. All I do is
call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue. FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP
iPAQ HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine
or on the iPAQ to make this work?
 
D

David

This code works and correctly returns the 10.0.0.20 ip address. Thus, I have
connectivity.

IPAddress[] addresses = Dns.GetHostEntry("david-1").AddressList;

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
Hmmm. Well, that suggests that you don't have network continuity between
where you are and where the queue is or that you don't have message queue
running on the device or, maybe, on the PC. Doesn't the MSMQ for your
device come with some sort of administrative tool for checking the status,
etc.? Can you ping or otherwise verify network connectivity between the
two ends of your communication path?

Paul T.

David said:
I have tried this on both the iPAQ and the Vista-32 machine:

if
(!MessageQueue.Exists(@"FormatName:DIRECT=TCP:10.0.0.20\private$\callerid"))

I get this error:

Cannot determine whether a queue with the specified format name exists


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:%[email protected]...
I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with the same results.

I now have a simple client on another Vista-32 machine. All I do is
call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue. FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management
tool.

I now have a simple app written for the compact framework on an HP
iPAQ HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false.
I can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine
or on the iPAQ to make this work?
 
D

David

A slightly different issue. This is all on the Vista machine, not the iPAQ
now. Here is some code. The m_queue.BeginReceive method gets called, but
after a few seconds it throws an exception which is caught, but the ex
variable is null. My MessageArrived method is never called either even
though I have added it to the ReceiveCompleted event. Now I dont know what
to do. This is pretty darn simple code. I can see two messages in the queue
on david-1. I can run the server app on david-1 at the same time as the
remote side is running. The server app creates new entries but still the
MessageArrived handler is not called and a bogus exception is thrown.

Ideas?

public partial class Form1 : Form
{
private MessageQueue m_queue;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
try
{
string deviceIP = String.Empty;
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
for (int i = 0; i < addresses.Length; ++i)
{
IPAddress addr = addresses;
if (addr.AddressFamily == AddressFamily.InterNetwork)
{
deviceIP = addr.ToString();
break;
}
}
if (deviceIP == String.Empty)
{
MessageBox.Show("Unable to retrieve Device IP");
Close();
return;
}

String strPath =
String.Format(@"FormatName:DIRECT=TCP:{0}\PRIVATE$\CallerID", deviceIP);
m_queue = new MessageQueue(strPath);

if (m_queue != null)
{
System.Type[] types = new Type[1];
types[0] = typeof(CallerIDClient.CallerID);
m_queue.Formatter = new XmlMessageFormatter(types);

try
{
m_queue.ReceiveCompleted += new
ReceiveCompletedEventHandler(MessageArrived);
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
Close();
}

Thread t1 = new Thread(PeekMessages);
t1.IsBackground = true;
t1.Start();
}
else
{
MessageBox.Show("Queue not created");
Close();
}
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}

private void PeekMessages()
{
while (true)
{
try
{
m_queue.BeginReceive();
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}

public void MessageArrived(Object source, ReceiveCompletedEventArgs
args)
{
MessageQueue queue = source as MessageQueue;
Message message = queue.EndReceive(args.AsyncResult);

CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}

private void AddItem(String strID)
{
Message message = m_queue.PeekById(strID);
CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}
}


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
Hmmm. Well, that suggests that you don't have network continuity between
where you are and where the queue is or that you don't have message queue
running on the device or, maybe, on the PC. Doesn't the MSMQ for your
device come with some sort of administrative tool for checking the status,
etc.? Can you ping or otherwise verify network connectivity between the
two ends of your communication path?

Paul T.

David said:
I have tried this on both the iPAQ and the Vista-32 machine:

if
(!MessageQueue.Exists(@"FormatName:DIRECT=TCP:10.0.0.20\private$\callerid"))

I get this error:

Cannot determine whether a queue with the specified format name exists


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:%[email protected]...
I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with the same results.

I now have a simple client on another Vista-32 machine. All I do is
call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue. FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management
tool.

I now have a simple app written for the compact framework on an HP
iPAQ HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false.
I can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine
or on the iPAQ to make this work?
 
D

David

Simon, do you have anything to add to the thread with Paul G. Tobey?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

Please don't treat the thread like a chat! Extra "what do *you* think?"
messages just clutter things up.

Paul T.

David said:
Simon, do you have anything to add to the thread with Paul G. Tobey?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

Can't help you with Vista.

There's little sample code for Windows CE and 97% of the problems I've had
have been configuration problems or just the service not running.

Paul T.

David said:
A slightly different issue. This is all on the Vista machine, not the iPAQ
now. Here is some code. The m_queue.BeginReceive method gets called, but
after a few seconds it throws an exception which is caught, but the ex
variable is null. My MessageArrived method is never called either even
though I have added it to the ReceiveCompleted event. Now I dont know what
to do. This is pretty darn simple code. I can see two messages in the queue
on david-1. I can run the server app on david-1 at the same time as the
remote side is running. The server app creates new entries but still the
MessageArrived handler is not called and a bogus exception is thrown.

Ideas?

public partial class Form1 : Form
{
private MessageQueue m_queue;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
try
{
string deviceIP = String.Empty;
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
for (int i = 0; i < addresses.Length; ++i)
{
IPAddress addr = addresses;
if (addr.AddressFamily == AddressFamily.InterNetwork)
{
deviceIP = addr.ToString();
break;
}
}
if (deviceIP == String.Empty)
{
MessageBox.Show("Unable to retrieve Device IP");
Close();
return;
}

String strPath =
String.Format(@"FormatName:DIRECT=TCP:{0}\PRIVATE$\CallerID", deviceIP);
m_queue = new MessageQueue(strPath);

if (m_queue != null)
{
System.Type[] types = new Type[1];
types[0] = typeof(CallerIDClient.CallerID);
m_queue.Formatter = new XmlMessageFormatter(types);

try
{
m_queue.ReceiveCompleted += new
ReceiveCompletedEventHandler(MessageArrived);
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
Close();
}

Thread t1 = new Thread(PeekMessages);
t1.IsBackground = true;
t1.Start();
}
else
{
MessageBox.Show("Queue not created");
Close();
}
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}

private void PeekMessages()
{
while (true)
{
try
{
m_queue.BeginReceive();
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}

public void MessageArrived(Object source, ReceiveCompletedEventArgs
args)
{
MessageQueue queue = source as MessageQueue;
Message message = queue.EndReceive(args.AsyncResult);

CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}

private void AddItem(String strID)
{
Message message = m_queue.PeekById(strID);
CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}
}


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
Hmmm. Well, that suggests that you don't have network continuity between
where you are and where the queue is or that you don't have message queue
running on the device or, maybe, on the PC. Doesn't the MSMQ for your
device come with some sort of administrative tool for checking the
status, etc.? Can you ping or otherwise verify network connectivity
between the two ends of your communication path?

Paul T.

David said:
I have tried this on both the iPAQ and the Vista-32 machine:

if
(!MessageQueue.Exists(@"FormatName:DIRECT=TCP:10.0.0.20\private$\callerid"))

I get this error:

Cannot determine whether a queue with the specified format name exists


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
I think that you've left out the type of the path. Have you tried
DIRECT=OS:, etc.? It may simply be that the desktop framework is
constructing that for you by default and the CF is not or something.

Paul T.

I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with the same results.

I now have a simple client on another Vista-32 machine. All I do is
call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong with my path?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
I don't use MSMQ on a daily basis, but I've used this sort of string

DIRECT=OS:farside\\private$\\lp45incoming

before, where farside was the NetBIOS name of the system hosting the
queue. I'm not sure that DNS can be used to resolve the name, but the
name you're using is not being resolved with DNS, I'd bet.

Paul T.

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue. FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries have been correctly created with the Computer Management
tool.

I now have a simple app written for the compact framework on an HP
iPAQ HP 2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false.
I can call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working properly.

Is there something special that I have to do on the Vista-64 machine
or on the iPAQ to make this work?
 
S

Simon Hart [MVP]

Are you running the following line:
MessageQueue.Exists(@"david-1\private$\callerid") on a remote machine (not on
david-1)? if so this is not supported for private queues. Checking the
existence of remote queues can only be done if the queue is public - in which
case active directory is required.

When executing the Exists method on a local machine the proper syntax is:
MessageQueue.Exists(@".\private$\callerid").

Period '.' meaning localhost machine.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20, with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is wrong
with my path?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine or
on
the iPAQ to make this work?
 
P

Paul G. Tobey [eMVP]

Simon,

You know everything. :)

Paul T.

Simon Hart said:
Are you running the following line:
MessageQueue.Exists(@"david-1\private$\callerid") on a remote machine (not
on
david-1)? if so this is not supported for private queues. Checking the
existence of remote queues can only be done if the queue is public - in
which
case active directory is required.

When executing the Exists method on a local machine the proper syntax is:
MessageQueue.Exists(@".\private$\callerid").

Period '.' meaning localhost machine.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong
with my path?

Simon Hart said:
Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP
iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine
or
on
the iPAQ to make this work?
 
D

David

Here is some code. The m_queue.BeginReceive method gets called, but
after a few seconds it throws an exception which is caught, but the ex
variable is null. My MessageArrived method is never called either even
though I have added it to the ReceiveCompleted event. Now I dont know what
to do. This is pretty darn simple code. I can see two messages in the queue
on david-1. I can run the server app on david-1 at the same time as the
remote side is running. The server app creates new entries but still the
MessageArrived handler is not called and a bogus exception is thrown.

Ideas why this does not work?

public partial class Form1 : Form
{
private MessageQueue m_queue;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
try
{
string deviceIP = String.Empty;
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
for (int i = 0; i < addresses.Length; ++i)
{
IPAddress addr = addresses;
if (addr.AddressFamily == AddressFamily.InterNetwork)
{
deviceIP = addr.ToString();
break;
}
}
if (deviceIP == String.Empty)
{
MessageBox.Show("Unable to retrieve Device IP");
Close();
return;
}

String strPath =
String.Format(@"FormatName:DIRECT=TCP:{0}\PRIVATE$\CallerID", deviceIP);
m_queue = new MessageQueue(strPath);

if (m_queue != null)
{
System.Type[] types = new Type[1];
types[0] = typeof(CallerIDClient.CallerID);
m_queue.Formatter = new XmlMessageFormatter(types);

try
{
m_queue.ReceiveCompleted += new
ReceiveCompletedEventHandler(MessageArrived);
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
Close();
}

Thread t1 = new Thread(PeekMessages);
t1.IsBackground = true;
t1.Start();
}
else
{
MessageBox.Show("Queue not created");
Close();
}
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}

private void PeekMessages()
{
while (true)
{
try
{
m_queue.BeginReceive();
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}

public void MessageArrived(Object source, ReceiveCompletedEventArgs
args)
{
MessageQueue queue = source as MessageQueue;
Message message = queue.EndReceive(args.AsyncResult);

CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}

private void AddItem(String strID)
{
Message message = m_queue.PeekById(strID);
CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}
}
 
S

Simon Hart [MVP]

Well I sometimes forget my wifes birthday! ;)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Paul G. Tobey said:
Simon,

You know everything. :)

Paul T.

Simon Hart said:
Are you running the following line:
MessageQueue.Exists(@"david-1\private$\callerid") on a remote machine (not
on
david-1)? if so this is not supported for private queues. Checking the
existence of remote queues can only be done if the queue is public - in
which
case active directory is required.

When executing the Exists method on a local machine the proper syntax is:
MessageQueue.Exists(@".\private$\callerid").

Period '.' meaning localhost machine.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


David said:
I have replaced the david-1 with the ip address of david-1, 10.0.0.20,
with
the same results.

I now have a simple client on another Vista-32 machine. All I do is call:

MessageQueue.Exists(@"david-1\private$\callerid")

I get an error stating that I have an invalid queue path name. What is
wrong
with my path?

Try using the IP address instead of OS and netbios name. IE:
FormatName:DIRECT=TCP:192.168.0.1\private$\callerid

Where the 192.168.0.1 is your IP of you machine. You could even see if
ppp_peer works for the IP (not sure if it would).
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

This is all .NET 3.5 with Visual Studio 2008

I have a simple app on Windows Vista-64 that creates a messaging
queue.
FormatName:DIRECT=OS:david-1\private$\callerid.

The app then writes a couple of entries. I have verified that the
entries
have been correctly created with the Computer Management tool.

I now have a simple app written for the compact framework on an HP
iPAQ
HP
2790. MSMQ has been installed on it. When I call
MessageQueue.Exists(@"david-1\private$\callerid"), it returns false. I
can
call this code:

IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;

and the correct address comes back so I know networking and dns are
working
properly.

Is there something special that I have to do on the Vista-64 machine
or
on
the iPAQ to make this work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top