Click here to Skip to main content
15,927,699 members
Home / Discussions / C#
   

C#

 
AnswerRe: Use Telerik Report but I Had Some Probelms Pin
Ashfield5-Nov-08 4:08
Ashfield5-Nov-08 4:08 
GeneralRe: Use Telerik Report but I Had Some Probelms Pin
Paul Conrad5-Nov-08 4:28
professionalPaul Conrad5-Nov-08 4:28 
Questionhow to change the title in ColorDialog in VC#? Pin
Seraph_summer5-Nov-08 2:32
Seraph_summer5-Nov-08 2:32 
AnswerRe: how to change the title in ColorDialog in VC#? Pin
cyber-drugs5-Nov-08 2:48
cyber-drugs5-Nov-08 2:48 
GeneralRe: how to change the title in ColorDialog in VC#? Pin
Giorgi Dalakishvili5-Nov-08 3:09
mentorGiorgi Dalakishvili5-Nov-08 3:09 
AnswerRe: how to change the title in ColorDialog in VC#? Pin
DaveyM695-Nov-08 3:58
professionalDaveyM695-Nov-08 3:58 
Questioncreating Assembly interpreter using C/C++ Pin
Chirantan_skc5-Nov-08 1:25
Chirantan_skc5-Nov-08 1:25 
AnswerRe: creating Assembly interpreter using C/C++ Pin
Ashfield5-Nov-08 1:36
Ashfield5-Nov-08 1:36 
JokeRe: creating Assembly interpreter using C/C++ Pin
Pedram Behroozi5-Nov-08 1:45
Pedram Behroozi5-Nov-08 1:45 
GeneralRe: creating Assembly interpreter using C/C++ Pin
Guffa5-Nov-08 3:24
Guffa5-Nov-08 3:24 
AnswerRe: creating Assembly interpreter using C/C++ Pin
Paul Conrad5-Nov-08 4:30
professionalPaul Conrad5-Nov-08 4:30 
Questionhow to create new RTF file Pin
raj2313625-Nov-08 0:56
raj2313625-Nov-08 0:56 
AnswerRe: how to create new RTF file Pin
Michael Bookatz5-Nov-08 2:16
Michael Bookatz5-Nov-08 2:16 
QuestionBrowse For Folder Pin
Abdul Rahman Hamidy5-Nov-08 0:27
Abdul Rahman Hamidy5-Nov-08 0:27 
AnswerRe: Browse For Folder Pin
cyber-drugs5-Nov-08 0:31
cyber-drugs5-Nov-08 0:31 
GeneralRe: Browse For Folder Pin
Abdul Rahman Hamidy8-Nov-08 21:49
Abdul Rahman Hamidy8-Nov-08 21:49 
AnswerRe: Browse For Folder Pin
Giorgi Dalakishvili5-Nov-08 0:46
mentorGiorgi Dalakishvili5-Nov-08 0:46 
AnswerRe: Browse For Folder Pin
J4amieC5-Nov-08 0:48
J4amieC5-Nov-08 0:48 
QuestionComparer [modified] Pin
ezazazel5-Nov-08 0:04
ezazazel5-Nov-08 0:04 
AnswerRe: Comparer Pin
Guffa5-Nov-08 2:51
Guffa5-Nov-08 2:51 
QuestionReceive replies to a UDP broadcast Pin
Olivier Sannier4-Nov-08 23:39
Olivier Sannier4-Nov-08 23:39 
Hi all,

I'm currently trying to receive replies to a UDP broadcast that I sent and I can't get it to work. I know the datagrams are sent as I see them with WireShark, but my C# code does not see them.
Here is how I intended things to work:

Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
try
{
// Send data to the broadcast address
IPEndPoint broadcastIEP = new IPEndPoint(IPAddress.Broadcast, port);
socket.Connect(broadcastIEP);
socket.Send(data);

// Wait for someone to respond
for (int i = 0; i < 50; i++)
{
int availableBytes = socket.Available;
if (availableBytes > 0)
{
byte[] buffer = new byte[availableBytes];
socket.Receive(buffer, 0, availableBytes, SocketFlags.None);

return ASCIIEncoding.ASCII.GetString(buffer);
}
System.Threading.Thread.Sleep(100);
}
return "Nobody replied";
}
finally
{
socket.Close();
}


The intent is to send a UDP broadcast and wait for the first machine that replies. The wait should stop after a while.
I must be doing something wrong here, but I'm quite lost as to what I should be doing. I tried "ReceiveFrom", but it is a blocking call and it never seems to return. I see the datagrams coming through (using WireShark) but ReceiveFrom does not return.

Thanks for your help
Cheers
Olivier
AnswerRe: Receive replies to a UDP broadcast Pin
Mark Salsbery5-Nov-08 5:22
Mark Salsbery5-Nov-08 5:22 
GeneralRe: Receive replies to a UDP broadcast Pin
Olivier Sannier5-Nov-08 22:28
Olivier Sannier5-Nov-08 22:28 
QuestionDrag and Drop TreeView Pin
Paul Unsworth4-Nov-08 23:36
Paul Unsworth4-Nov-08 23:36 
AnswerRe: Drag and Drop TreeView Pin
cyber-drugs5-Nov-08 0:22
cyber-drugs5-Nov-08 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.