public static SenderSocket Create(IPAddress ip, SocketSide socketSide, SocketEventProvider eventProvider) { switch (socketSide) { default: case SocketSide.Server: return(new TcpServerSocket(ip, eventProvider)); case SocketSide.Client: return(new TcpClientSocket(ip, eventProvider)); } }
public void Initialize(SystemSocket acceptSocket) { socket = acceptSocket; socketEventProvider = SocketEventProvider.Create(this); DoAsync(OnConnected); bool willRaiseEvent = socket.ReceiveAsync(socketEventProvider.ReceiveEvent); if (willRaiseEvent == false) { socketEventProvider.ProcessReceive(socketEventProvider.ReceiveEvent); } }
public TcpServerSocket(IPAddress ip, SocketEventProvider eventProvider) : base(ip, SocketType.Stream, SocketSide.Server, eventProvider) { }
public static SenderSocket Create <T>(IPAddress ip, SocketEventProvider eventProvider) { return((SenderSocket)Activator.CreateInstance(typeof(T), BindingFlags.Public | BindingFlags.Instance, null, new object[] { ip, eventProvider }, null)); }
public TcpReceiveSocket(Socket socket, SocketSide socketSide, SocketEventProvider eventProvider) : base(((IPEndPoint)socket.RemoteEndPoint).Address, SocketType.Stream, socketSide, eventProvider) { Sock = socket; }
public UdpSocket(IPAddress ip, SocketSide socketSide, SocketEventProvider eventProvider) : base(ip, SocketType.Dgram, socketSide, eventProvider) { }
public TcpClientSocket(IPAddress ip, SocketEventProvider eventProvider) : base(ip, SocketType.Stream, SocketSide.Client, eventProvider) { }