Exemple #1
0
        public ChoUDPServer(IPEndPoint serverEndPoint, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null, int timeToLive = 0)
        {
            ChoGuard.ArgumentNotNullOrEmpty(serverEndPoint, "EndPoint");

            _serverEndPoint = serverEndPoint;
            _messageType    = messageType;
            if (encoding != null)
            {
                _encoding = encoding;
            }
            _serverSocket.JoinMulticastGroup(serverEndPoint.Address, timeToLive);
        }
Exemple #2
0
        public ChoUDPServer(IPAddress multicastAddress, int port, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null)
            //: this(new IPEndPoint(ipAddress, port), messageType, encoding)
        {
            UdpClient client = new UdpClient(new IPEndPoint(IPAddress.Any, port));
            
            foreach (IPAddress localAddress in ChoUDPClient.LocalAddresses)
            {
                client.JoinMulticastGroup(multicastAddress, localAddress);
                _sendClients.Add(new UdpClient(new IPEndPoint(localAddress, port)));
            }
            listener.Client.Bind(new IPEndPoint(localAddress, port));


            _serverEndPoint = new IPEndPoint(multicastAddress, port);
            _messageType = messageType;
            if (encoding != null)
                _encoding = encoding;
        }
Exemple #3
0
 public ChoUDPServer(string multicastAddress, int port, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null)
     : this(IPAddress.Parse(multicastAddress), port)
 {
 }
Exemple #4
0
 public ChoUDPServer(IPAddress multicastAddress, int port, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null, int timeToLive = 0)
     : this(new IPEndPoint(multicastAddress, port), messageType, encoding)
 {
 }