c# - Return data using BeginReceive to another method in different class -


I am using the following code to get the asynchronous datagram in the class named "UDPComm" . What do I do:

  1. I have another class with the name manager which sends a message over the UDP connection UPComm.send (byte [])
  2. Then it calls to UDPComm.startListening () to listen to the message.

My problem is, how do I get in the code () in the manager class? I tried to add a refund but give me an error in udp.BeginReceive (received, new object ()). .

Your help is highly appreciated.

  Private Wide StartLiving () {try {ar_ = udp.BeginReceive (Received, New Object ()); } Hold (exception E) {System.Diagnostics.Debug.WriteLine ("Exception in StartListening") + e.ToString ()); }} `Private zero receipt (IASINCRSULT AR) {byte [] bytes = udp.EndReceive (AR, REF NetworkIntpointIp); } ` 


Comments