Socket problem

  • Thread starter Thread starter BartBilliet
  • Start date Start date
B

BartBilliet

Hello guys,

I've made a application who receives data trough a socket from a
machine. But when the machine is switched off (so without closing the
socket), I want to check if the machine is on or off. When the
machine is off I set a timer who checks every 10 sec if the machine
is switched on in the meanwhile and if he is switched on I make a new
socket connection. But how can I detect when my endpoint (the
machine) is off. Because when I sent data to the machine trough the
socket when the machine is off there 's no problem. (Just get number
of sent bytes even if machine is switched off) Please help me!

Thanks,

Bart Billiet
 
try:

Socket appSoc = TcpListener.accpet();

use threading, and check if appSoc is connected, but remember that even your
appSoc is disconnected, your listener is still listening, remember that use
Stop();

if(appSoc.Connected){
endPointOff=true;
}else{
endPointOff=false;
}


BartBilliet said:
Hello guys,

I've made a application who receives data trough a socket from a
machine. But when the machine is switched off (so without closing the
socket), I want to check if the machine is on or off. When the
machine is off I set a timer who checks every 10 sec if the machine
is switched on in the meanwhile and if he is switched on I make a new
socket connection. But how can I detect when my endpoint (the
machine) is off. Because when I sent data to the machine trough the
socket when the machine is off there 's no problem. (Just get number
of sent bytes even if machine is switched off) Please help me!

Thanks,

Bart Billiet



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Thanks for the reply pei_world but aSocket.Connected doesn't work in
this case it works only when the machine does a socket close() and
then the PC sends data then you retreive the real value of Connected.
But when the machine doesn't close his socket you can't use
Connected.
Anyone another solution.

Thanks in advance,

Bart Billiet
 
Back
Top