udp (UdpClient) not transmitting in vista

G

Guest

I have a program (works fine under XP), sends a udp message using .net
udpclient and listens for a udp response from dedicated music server that our
company manufactures. It does not work under Vista.

I have Norton Anit-virus for Vista (completely turned off).
I also have Windows firewall (completely turned off).
Windows Firewall with Advanced Security shows everything turned off and no
rules.
I am not running Windows One-Care.

The hardware that should receive the udp message shows that it receives the
message when sent from Windows XP box, but not when sent from Vista.

Is this a known change from XP to Vista - or is there something else that
could be blocking the udp transmission?

Code portion that is not working in Vista:

UdpClient udpClientTx = new UdpClient();
byte[] sendBytes = Encoding.ASCII.GetBytes("ARQFIND ROLLCALL:\0");
IPEndPoint transmitIpep = new IPEndPoint(System.Net.IPAddress.Broadcast,
3662);
udpClientTx.Send(sendBytes, sendBytes.Length, transmitIpep);
udpClientTx.Close();

Thanks,
Jim Mead
 
C

Charles Wang[MSFT]

Hi Jim,
Did you mean that the code worked normally but your hardware could not
receive the data or the code failed working on Vista?

I performend a test on both Windows XP and Windows Vista and everything
worked fine. My test code is as following:
============================================
Console.WriteLine("Set send times: ");
Console.WriteLine("Set send times: ");
string strCount = Console.ReadLine();
try
{
UdpClient client = new UdpClient();
int nPort = 15000;
IPEndPoint ep = new IPEndPoint(IPAddress.Broadcast,
nPort);
byte[] bytes =
System.Text.ASCIIEncoding.ASCII.GetBytes("HELLO.\0");

for (int i = 0; i < int.Parse(strCount); ++i)
{
int nSent = client.Send(bytes, bytes.Length, ep);
System.Threading.Thread.Sleep(1000);
Console.WriteLine("TIME:" +
DateTime.Now.ToString("HH:mm:ss.fff") + " SENT: Hello check has been
sent!");
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
================================================

I run the test code on Vista for sending 100 times and then I used Network
Monitor 3.0 to monitor the network traffic by filtering IPv4.SourceAddress
== xxx.xxx.xxx.xxx on my Windows XP machine, and I found that all the
packets were captured by NetMon.

Your code seemed fine. I recommend that you check your network conditions
to see if your Vista machine can access the target hardware. If the
physical connection could not established, your hardware could not receive
the packets at all. You may also use Network Monitor to see if you can
receive the packets on another machine.

Hope this helps. If you have any other questions or concerns, please feel
free to let me know.

Have a good day!

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 
G

Guest

Thank you Charles,

When I run NetMon 3.0 in XP, I see the UDP transmission and associated
replies.
When I run NetMon 3.0 in Vista, I do not see either of these.


I noticed that on my XP box, the NetMon "Select Networks" tab only has one
Local Area Network.

On my Vista laptop, I see three local network choices, although two of them
say "This network adapter is not configured to capture".

When I disabled all but one network adapter, NetMon sees the UDP messages,
amd my program works correctly.

Is there a way to specify which network adapter to use with UDP?

Thanks,
Jim Mead
 
C

Charles Wang[MSFT]

Hi Jim,
Did your machine have three NICs?
For your question, Is there a way to specify which network adapter to use
with UDP? This is decided by your IPEndpoint. For IPAddress.Broadcast and
IPAddress.Any, they are both for all NICs, so you could not specify a
network adapter for either of them.
Normally in a common UDP application, we can create an IPEndpoint with an
IP address of one network adapter and bind it as the server side.

Appreciate your understanding that due to resource limitation, I could not
reproduce your issue at my side. If you are very concerned with this issue,
effectively and immediately I recommend that you contact Microsoft Customer
Support Services (CSS) via telephone for the best support.

To obtain the phone numbers for specific technology request please take a
look at the web site listed below.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS

If you are outside the US please see http://support.microsoft.com for
regional support phone numbers.

If you have any other questions or concerns, please feel free to let me
know.
Have a good day!

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 
P

Peter Duniho

Hi Jim,
Did your machine have three NICs?
For your question, Is there a way to specify which network adapter to use
with UDP? This is decided by your IPEndpoint. For IPAddress.Broadcast
and
IPAddress.Any, they are both for all NICs, so you could not specify a
network adapter for either of them.
Normally in a common UDP application, we can create an IPEndpoint with an
IP address of one network adapter and bind it as the server side.

Are you sure about this?

Using regular Winsock or other networking APIs, the local endpoint
determines what adapter *receives* data. But which adapter is used to
*send* data is determined by the remote endpoint along with whatever
routing algorithm the network drivers use. If the network stack
determines that the data is more efficiently sent via some other adapter
than the receiving adapter, it will do that.

Explicit routing can be managed at a lower level (i.e. not via Winsock),
but is usually impractical for most applications.

I don't know for a fact that the .NET Socket class works the same way, but
on the assumption that it simply "wraps" Winsock, then it will.

Pete
 
C

Charles Wang[MSFT]

Hi Pete,
Thanks for your pointing out. I missed writing the IPEndpoint for sending
data. I just talked one scenario on the UDP server side which need to bind
a local endpoint.
NET Socket class is a wrapper of WINSOCK.

Thanks and have a good day!

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 

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