public StrongConnect(string host, int port, string fn) { Socket?socket = null; try { IPEndPoint ep; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); if (char.IsDigit(host[0])) { IPAddress ip = IPAddress.Parse(host); ep = new IPEndPoint(ip, port); socket.Connect(ep); } else { #if MONO1 var he = Dns.GetHostByName(hostName); #else IPHostEntry he = Dns.GetHostEntry(host); #endif for (int j = 0; j < he.AddressList.Length; j++) { try { IPAddress ip = he.AddressList[j]; ep = new IPEndPoint(ip, port); socket.Connect(ep); if (socket.Connected) { break; } } catch (Exception) { } } } } catch (Exception) { } if (socket == null || !socket.Connected) { throw new Exception("No connection to " + host + ":" + port); } asy = new ClientStream(this, socket); var wtr = asy.wtr; wtr.PutString(fn); asy.Flush(); asy.Receive(); preps = SDict <long, string> .Empty; }