/// <summary> /// Creates a new TcpCommunicationChannel object. /// </summary> /// <param name="clientSocket">A connected Socket object that is /// used to communicate over network</param> public TcpCommunicationChannel(Socket clientSocket) { _clientSocket = clientSocket; _clientSocket.NoDelay = true; var ipEndPoint = (IPEndPoint)_clientSocket.RemoteEndPoint; _remoteEndPoint = new CJiaEndPoint(ipEndPoint.Address.ToString(), ipEndPoint.Port); _buffer = new byte[ReceiveBufferSize]; _syncLock = new object(); }
/// <summary> /// 初始化数据访问组件 /// </summary> public void Init() { if (netEP != null && (netEP.IpAddress != ClientConfig.ServerIP || netEP.TcpPort != ClientConfig.ServerPort)) { if (dataClient != null && dataClient.CommunicationState == Net.Communication.CommunicationStates.Connected) { dataClient.Disconnect(); } } netEP = new CJiaEndPoint(ClientConfig.ServerIP, ClientConfig.ServerPort); dataClient = CJiaClientBuilder.CreateClientApplication <CJia.Net.Service.IDataAdapter>(netEP); dataClient.Timeout = 6000 * 10; //三分钟超时 dataClient.AllowAutoPing = false; dataClient.PingInterval = 30000; //30秒 dataClient.Connect(); dataClient.ServiceProxy.Init(ClientCode, DbName); }
/// <summary> /// Creates a new ScsTcpClient object. /// </summary> /// <param name="serverEndPoint">The endpoint address to connect to the server</param> public CJiaTcpClient(CJiaEndPoint serverEndPoint) { _serverEndPoint = serverEndPoint; }
/// <summary> /// Creates a new TcpConnectionListener for given endpoint. /// </summary> /// <param name="endPoint">The endpoint address of the server to listen incoming connections</param> public TcpConnectionListener(CJiaEndPoint endPoint) { _endPoint = endPoint; }
/// <summary> /// Creates a new SCS Server using an EndPoint. /// </summary> /// <param name="endPoint">Endpoint that represents address of the server</param> /// <returns>Created TCP server</returns> public static IServer CreateServer(CJiaEndPoint endPoint) { return(endPoint.CreateServer()); }
/// <summary> /// Creates a new ScsTcpServer object. /// </summary> /// <param name="endPoint">The endpoint address of the server to listen incoming connections</param> public CJiaTcpServer(CJiaEndPoint endPoint) { _endPoint = endPoint; }
/// <summary> /// Creates a new client to connect to a server using an end point. /// </summary> /// <param name="endpoint">End point of the server to connect it</param> /// <returns>Created TCP client</returns> public static IClient CreateClient(CJiaEndPoint endpoint) { return(endpoint.CreateClient()); }