123456789101112131415161718192021222324252627282930313233 |
- using LJLib.Net.SPI.Client;
- using System;
- using System.Net;
- using System.Net.Sockets;
- using LJLib.IP;
- namespace LJLib.Client
- {
- public sealed class DirectP1ClientCreator : LJClientCreator
- {
- private string _url;
- private IPAddress _ip = null;
- private int _port;
- public DirectP1ClientCreator(String url, int port)
- {
- _url = url;
- _port = port;
- }
- public override ILJClient newClient()
- {
- if (_ip == null)
- {
- _ip = IPUtils.GetURLIPv4(_url);
- }
- var tcpClient = new TcpClient();
- tcpClient.Connect(_ip, _port);
- return new P1Client(tcpClient.GetStream());
- }
- }
- }
|