M
mc
I have a function (shown below) that I call to check if a server is present. when a server is
present, everything is ok. however when it fails. I get an SocketException fired. On my development
machine all seems to work and the exception is fired and caught. however on my production server the
exception fires, it's not caught by the try catch and it's also not caught in my application_error
handler in Global.asax. Can anyone shed any light on this?
private bool CheckServer(string p){
try{
using (Socket s = new Socket(AddressFamily.Internetwork, SocketType.Stream, ProtocolType.Tcp)){
IPEndPoint iep = new IPEndPoint(DNS.GetHostEntry(p).AddressList[0], 80);
s.Connect(iep);
return true;
}
}
catch{
return false;
}
}
TIA
MC
present, everything is ok. however when it fails. I get an SocketException fired. On my development
machine all seems to work and the exception is fired and caught. however on my production server the
exception fires, it's not caught by the try catch and it's also not caught in my application_error
handler in Global.asax. Can anyone shed any light on this?
private bool CheckServer(string p){
try{
using (Socket s = new Socket(AddressFamily.Internetwork, SocketType.Stream, ProtocolType.Tcp)){
IPEndPoint iep = new IPEndPoint(DNS.GetHostEntry(p).AddressList[0], 80);
s.Connect(iep);
return true;
}
}
catch{
return false;
}
}
TIA
MC