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); }
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; }
public ChoUDPServer(string multicastAddress, int port, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null) : this(IPAddress.Parse(multicastAddress), port) { }
public ChoUDPServer(IPAddress multicastAddress, int port, ChoUDPMessageType messageType = ChoUDPMessageType.Binary, Encoding encoding = null, int timeToLive = 0) : this(new IPEndPoint(multicastAddress, port), messageType, encoding) { }