public SqlServerConnection GetConnection(Type type) { if (type == typeof(SqlServerConnection)) { return(SqlServerConnection.GetInstance(connectionString)); } return(null); }
public Server(string path) { SetConfigPath(path); //IPv4的地址模式. 流式数据传输 if (!int.TryParse(ConfigurationManager.AppSettings["Port"], out _port)) { throw new Exception("端口配置错误"); } if (!IPAddress.TryParse(ConfigurationManager.AppSettings["IpAddress"], out _ipAddress)) { throw new Exception("Ip地址格式错误"); } sqlServerConnection = SqlServerConnection.GetInstance(configPath); serverSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint point = new IPEndPoint(_ipAddress, _port); serverSock.Bind(point); serverSock.Listen(0); }
public SqlServerConfig(string path) { InitializeComponent(); connection = SqlServerConnection.GetInstance(path); }