public void CreateTable(string n, params SColumn[] cols) { asy.Write(Types.SCreateTable); asy.PutString(n); asy.PutInt(cols.Length); foreach (var c in cols) { asy.PutString(c.name); asy.WriteByte((byte)c.dataType); } var b = asy.Receive(); }
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; }
public void CreateTable(string n) { var un = Prepare(n); var wtr = asy.wtr; wtr.SendUids(preps); wtr.Write(Types.SCreateTable); wtr.PutLong(un); wtr.PutInt(0); wtr.PutInt(0); var b = asy.Receive(); preps = SDict <long, string> .Empty; }