Click here to Skip to main content
15,908,015 members
Home / Discussions / C#
   

C#

 
GeneralRe: Determining file state (open or closed) Pin
Nitin19813-Oct-06 21:04
Nitin19813-Oct-06 21:04 
AnswerRe: Determining file state (open or closed) Pin
S. Senthil Kumar4-Oct-06 4:29
S. Senthil Kumar4-Oct-06 4:29 
QuestionPrevent Application Close / Detech Application started Pin
Major_A3983-Oct-06 16:14
Major_A3983-Oct-06 16:14 
AnswerRe: Prevent Application Close / Detech Application started Pin
LongRange.Shooter4-Oct-06 7:12
LongRange.Shooter4-Oct-06 7:12 
AnswerRe: Prevent Application Close / Detech Application started Pin
Major_A3984-Oct-06 12:35
Major_A3984-Oct-06 12:35 
GeneralRe: Prevent Application Close / Detech Application started Pin
LongRange.Shooter4-Oct-06 14:52
LongRange.Shooter4-Oct-06 14:52 
GeneralRe: Prevent Application Close / Detech Application started Pin
Major_A3984-Oct-06 15:05
Major_A3984-Oct-06 15:05 
QuestionHow to implement a ReceiveCallback function??? Pin
CTaylor893-Oct-06 14:03
CTaylor893-Oct-06 14:03 
MSDN gives this code as an example to create a callback function for
UdpClient.BeginReceive. It doesn't compile because the compiler does
not recognize "UdpState". I can't find any info on it either. Does
anyone know what "UdpState" is or could you point me to some sample
code on how to properly implement a ReceiveCallback function for a UdpClient? Any help would be appreciated.

public static bool messageReceived = false;
public static void ReceiveCallback(IAsyncResult ar)
{
UdpClient u = (UdpClient)((UdpState)(ar.AsyncState)).u;
IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;

Byte[] receiveBytes = u.EndReceive(ar, ref e);
string receiveString = Encoding.ASCII.GetString(receiveBytes);

Console.WriteLine("Received: {0}", receiveString);
messageReceived = true;
}

MSDN link:
ms-help://MS.MSDN.vAug06.en/cpref10/html/M_System_Net_Sockets_UdpClient_BeginReceive_1_2bb042b2.htm




Craig

AnswerRe: How to implement a ReceiveCallback function??? Pin
Stefan Troschuetz3-Oct-06 21:14
Stefan Troschuetz3-Oct-06 21:14 
GeneralRe: How to implement a ReceiveCallback function??? Pin
CTaylor894-Oct-06 8:45
CTaylor894-Oct-06 8:45 
AnswerRe: remoting in c# Pin
LongRange.Shooter4-Oct-06 7:13
LongRange.Shooter4-Oct-06 7:13 
QuestionUnit Testing Pin
Jamie Nordmeyer3-Oct-06 12:56
Jamie Nordmeyer3-Oct-06 12:56 
AnswerRe: Unit Testing Pin
LongRange.Shooter4-Oct-06 7:15
LongRange.Shooter4-Oct-06 7:15 
GeneralRe: Unit Testing Pin
Jamie Nordmeyer4-Oct-06 7:17
Jamie Nordmeyer4-Oct-06 7:17 
QuestionPath of a current process? Pin
sundar1563-Oct-06 12:47
sundar1563-Oct-06 12:47 
AnswerRe: Path of a current process? Pin
User 66583-Oct-06 13:03
User 66583-Oct-06 13:03 
Questionbold and italic Pin
mostafasafy3-Oct-06 10:09
mostafasafy3-Oct-06 10:09 
AnswerRe: bold and italic Pin
Nader Elshehabi3-Oct-06 10:25
Nader Elshehabi3-Oct-06 10:25 
QuestionMODI Error Pin
smarttom993-Oct-06 9:30
smarttom993-Oct-06 9:30 
AnswerRe: MODI Error Pin
Nader Elshehabi3-Oct-06 9:39
Nader Elshehabi3-Oct-06 9:39 
QuestionWriting redirected output from an unmanaged executable to a windows form control Pin
erikash3-Oct-06 7:54
erikash3-Oct-06 7:54 
AnswerRe: Writing redirected output from an unmanaged executable to a windows form control Pin
led mike3-Oct-06 8:39
led mike3-Oct-06 8:39 
GeneralRe: Writing redirected output from an unmanaged executable to a windows form control Pin
erikash3-Oct-06 9:30
erikash3-Oct-06 9:30 
QuestionRe: Writing redirected output from an unmanaged executable to a windows form control Pin
erikash3-Oct-06 11:40
erikash3-Oct-06 11:40 
QuestionObject array question Pin
T.Willey3-Oct-06 7:21
T.Willey3-Oct-06 7:21 

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.