\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > MSMQ reply delay problem


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
Hello,
\r\n
\r\nI am new around here so I hope I am not breaking any rules posting this.
\r\n
\r\nAnyway, I developed a client-server application in VB6 communicating through MSMQ. They run on Windows XP Professional, using MS Message Queuing 3.0.
\r\n
\r\nSo, my basic setup goes like this:
\r\n
\r\n- I have "n" clients sending messages to the server and receiving a reply from it.
\r\n- I use asynchronous messages, so no need transactions.
\r\n- I do not use triggers at all.
\r\n- My queue names in the server and the client are fixed.
\r\n- I use a workgroup, not AD, so I am only using private queues.
\r\n- I use the DIRECT=TCP:<IP ADDRESS> format name to send the messages.
\r\n- The clients get a dynamic IP from DHCP, the server has a fixed IP address.
\r\n
\r\nMy problem comes when the clients start up (the machine resets) and they start sending messages to the server. The server receives the messages and replies to the client, however the messages stay in the Outgoing queue for like 1.5 minutes (they start to pile up) until (I guess) it "finds" the destination queue and are finally delivered (all at once). After this first messages are received from the server, the following ones arrive quite fast (with random short delays every now and then only).
\r\n
\r\nI have tried the following to fix this:
\r\n
\r\n- Ping the server from the client while the client sends the first messages.
\r\n- Wait a few minutes after starting the client before sending the first messages.
\r\n- Add a "TcpNoDelay" Dword entry to both the client and the server registry with a value of "1" under the MSMQ "Parameters" folder.
\r\n- Turn off the windows firewall in both the server and the client.
\r\n
\r\nThe code I am using to send the message is the following:
\r\n
\r\n
\r\n
Code:
\r\n
Option Explicit\r\n\r\n\'Queue send variables\r\nPublic qSendMX         As MSMQQueue\r\nPublic qSendInfoMX     As New MSMQQueueInfo\r\nPublic msgSendMX       As New MSMQMessage\r\n\r\n\'Connection string\r\nPublic strFormatNameSendMX     As String\r\n\r\nPrivate Sub Form_Load()\r\n\r\nstrFormatNameSendMX = "DIRECT=TCP:10.20.2.48\\PRIVATE$\\CJM01RecQ"\r\n\r\n\'Assign the connection string to the send queue\r\nqSendInfoMX.FormatName = strFormatNameSendMX\r\n        \r\nmsgSendMX.Body = "message"\r\nmsgSendMX.Label = "start"\r\n\r\nSet qSendMX = qSendInfoMX.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)\r\n\r\nmsgSendMX.Send qSendMX\r\n\r\nqSendMX.Close\r\n\r\nEnd Sub
\r\n
And the code I use to read the message is the following:
\r\n
\r\n
\r\n
Code:
\r\n
Option Explicit\r\n\r\nPrivate Sub ReceiveMessage_Click()\r\n\r\nDim strFormatName As String\r\nDim qi As New MSMQQueueInfo\r\nDim msg As New MSMQMessage\r\nDim q As MSMQQueue\r\n\r\nOn Error Resume Next\r\n\r\nstrFormatName = "DIRECT=.\\PRIVATE$\\CJM01ReplyQ"\r\nqi.FormatName = strFormatName\r\n  \r\nSet q = qi.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)\r\n\r\nSet msg = q.Receive(ReceiveTimeout:=1000)\r\n\r\nEnd Sub
\r\n
I really donīt know what else to do. The clients and the server are on an independent network from the rest of the machines and everything else seems to work pretty well, I just have this "first messages sent" delay problem. I have read about the ports needed by MSMQ but I am guessing that after turning the firewalls off this should not be a problem.
\r\n
\r\nWhat confuses me even more is the fact that the server program (a very small application which only receives and sends messages) does not seem to suffer from this problem, since it starts working right away after starting it, receiving and sending messages without any problem.
\r\n
\r\nI hope somebody can help me with this.
\r\n
\r\nThanks a lot.
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1332159] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 06-11-2009, 01:04 AM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
dilettante\'s Avatar\r\n\r\n
\r\n \r\n dilettante\r\n dilettante is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 06-10-2009, 08:24 PM
Rodoom Rodoom is offline
Newcomer
 
Join Date: Apr 2009
Posts: 5
Default MSMQ reply delay problem


Hello,

I am new around here so I hope I am not breaking any rules posting this.

Anyway, I developed a client-server application in VB6 communicating through MSMQ. They run on Windows XP Professional, using MS Message Queuing 3.0.

So, my basic setup goes like this:

- I have "n" clients sending messages to the server and receiving a reply from it.
- I use asynchronous messages, so no need transactions.
- I do not use triggers at all.
- My queue names in the server and the client are fixed.
- I use a workgroup, not AD, so I am only using private queues.
- I use the DIRECT=TCP:<IP ADDRESS> format name to send the messages.
- The clients get a dynamic IP from DHCP, the server has a fixed IP address.

My problem comes when the clients start up (the machine resets) and they start sending messages to the server. The server receives the messages and replies to the client, however the messages stay in the Outgoing queue for like 1.5 minutes (they start to pile up) until (I guess) it "finds" the destination queue and are finally delivered (all at once). After this first messages are received from the server, the following ones arrive quite fast (with random short delays every now and then only).

I have tried the following to fix this:

- Ping the server from the client while the client sends the first messages.
- Wait a few minutes after starting the client before sending the first messages.
- Add a "TcpNoDelay" Dword entry to both the client and the server registry with a value of "1" under the MSMQ "Parameters" folder.
- Turn off the windows firewall in both the server and the client.

The code I am using to send the message is the following:

Code:
Option Explicit

'Queue send variables
Public qSendMX         As MSMQQueue
Public qSendInfoMX     As New MSMQQueueInfo
Public msgSendMX       As New MSMQMessage

'Connection string
Public strFormatNameSendMX     As String

Private Sub Form_Load()

strFormatNameSendMX = "DIRECT=TCP:10.20.2.48\PRIVATE$\CJM01RecQ"

'Assign the connection string to the send queue
qSendInfoMX.FormatName = strFormatNameSendMX
        
msgSendMX.Body = "message"
msgSendMX.Label = "start"

Set qSendMX = qSendInfoMX.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)

msgSendMX.Send qSendMX

qSendMX.Close

End Sub
And the code I use to read the message is the following:

Code:
Option Explicit

Private Sub ReceiveMessage_Click()

Dim strFormatName As String
Dim qi As New MSMQQueueInfo
Dim msg As New MSMQMessage
Dim q As MSMQQueue

On Error Resume Next

strFormatName = "DIRECT=.\PRIVATE$\CJM01ReplyQ"
qi.FormatName = strFormatName
  
Set q = qi.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)

Set msg = q.Receive(ReceiveTimeout:=1000)

End Sub
I really donīt know what else to do. The clients and the server are on an independent network from the rest of the machines and everything else seems to work pretty well, I just have this "first messages sent" delay problem. I have read about the ports needed by MSMQ but I am guessing that after turning the firewalls off this should not be a problem.

What confuses me even more is the fact that the server program (a very small application which only receives and sends messages) does not seem to suffer from this problem, since it starts working right away after starting it, receiving and sending messages without any problem.

I hope somebody can help me with this.

Thanks a lot.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->