Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7592155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:50:08+00:00 2026-05-30T20:50:08+00:00

Using C#, does broadcasting over UDP repeatedly send its packet, or just once? I’ve

  • 0

Using C#, does broadcasting over UDP repeatedly send its packet, or just once?

I’ve never used this technology before and I want to temporarily broadcast small bit of info (a small one line string) over the LAN. If the receiving end isn’t ready will the broadcast repeat itself or was it a one time thing? The code I’m using is from here. So what I want to start the Broadcaster one one machine and a few minutes later start the receiver and retrieve what the broadcaster sent.

Here is the code

using System;  
using System.Net;  
using System.Net.Sockets;  
using System.Text;  
class Broadcst  
{  
  public static void Main()  
  {  
   Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,  
                ProtocolType.Udp);  
   IPEndPoint iep1 = new IPEndPoint(IPAddress.Broadcast, 9050);  
   IPEndPoint iep2 = new IPEndPoint(IPAddress.Parse("192.168.1.255"), 9050);  
   string hostname = Dns.GetHostName();  
   byte[] data = Encoding.ASCII.GetBytes(hostname);  
   sock.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.Broadcast, 1);  
   sock.SendTo(data, iep1);  
   sock.SendTo(data, iep2);  
   sock.Close();  
  }  
}  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:50:10+00:00Added an answer on May 30, 2026 at 8:50 pm

    UDP by design only sends a packet once. It has no concept of handshakes (unlike TCP), error correction, or transmission guarantees. You can’t even be sure that your data gets to where you send it unless you manually request checksums or something like that.

    Wikipedia has a nice section on this: Reliability and congestion control solutions in UDP.

    So, yes, you will need to implement transmission guarantee code if you want reliability. But what if the message from the recipient saying that the data was received is delayed? Well, then you need to implement some kind of timeout. What if the message gets lost? You need to resend the data to the recipient. How do you know if the recipient gets it this time? Etc…

    If you don’t want to do this, then I’d suggest looking into TCP which automatically manages this for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Instead of just using urllib does anyone know of the most efficient package for
Does anybody using latest enterprise library 4.1 in mono? I used mono migration analyzer
Does using $this->input->post(); in Codeigniter, remove any html and javascript the user of the
The telnet host I am using does not have a prompt character, (it just
Does using Multiple .NET Languages (Delphi, VB.NET, C#) into the same application (but in
When does using extension methods make sense? Does adding extension methods to a type
Does using Service Oriented Architecture (SOA) in a system mean it is a distributed
A using declaration does not seem to work with an enum type: class Sample{
2 questions: Does using MVC make it any easier to build 508/WAI compliant sites?
When applying the MVP pattern to ASP.NET applications, where does using AJAX to post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.