Ping Class - Assinchronous ping

teixeira

Well-known member
Joined
Apr 5, 2005
Messages
94
Location
LEIRIA-PORTUGAL
Hi All,

I wanna make a class to check when my printer is connected or disconnected from the network.
This is for prevent user to send a job without the printer beeing online, and with this i wanna show some alarms.
This is using a normal socket connection, and im pinging the printer when i start the program and when im ready to send a job to it.
I use the ping class and after the event has been PingCompleted raisen, i wanna make some actions, until here all well, but as the ping request is sent
assincronously i having some problems, because i wanna wait for ping status before i go ahead, see my code:

Code:
       /// <summary>
        /// Pinga a Impressora com 32Bytes de lixo e espera o echo da mensagem para verificar se est
 
The whole point of the SendAsync method is that it sends asynchronously and doesnt wait. If you need to wait just use the Send method instead.

Alternatively as you are handling the call via a callback why do you need to wait?
 
maybe youre right send just goes fine.
as i took this example from msft msdn help i make some confusion my self.
ill try like that

Thanks

Tiago Teixeira
 

Similar threads

Back
Top