Hi All,

I have a function which basically open a Socket connection for the client
which works fine with one IP.

public Socket open_Socket()
{
 try
 {
  socketClient = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
  String IPAddress  = "111.111.111.111";
  String IPPort = "2010";
  //......
  //some code here
  //......
  socketClient.Connect(remoteEndPoint);
  return socketClient ;
 }
 catch(SocketException)
 {
  msResponseCode = "1002";
  return null;
 }
}

My problem is,  I have a set of production IP address, which I need to use
to open a Socket in case IP1 doesn' t allow any connection or if it is not
available. So if I can't open a socket with IP1  then I need to try it with
IP2 and so on.

I know I can try opening a new socket on IP2, when I get SocketException on
IP1, but I am looking for a betterway to implement this without going into
Exception.

Thanks.

Raj

Reply via email to