| | |
| | | { |
| | | if (IsRunning) |
| | | { |
| | | if (port == _port) |
| | | { |
| | | return; |
| | | if (port == _port) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | busSocket.Close(); |
| | | busSocket.Close(); |
| | | } |
| | | } |
| | | _port = port; |
| | | } |
| | | _port = port; |
| | | |
| | | busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | busSocket.EnableBroadcast = true; |
| | | try { |
| | | busSocket.Bind (new IPEndPoint (IPAddress.Any, port)); |
| | | //busSocket.Bind (new IPEndPoint (IPAddress.Any, 6000)); |
| | | busSocket.Bind(new IPEndPoint(IPAddress.Any, port)); |
| | | |
| | | busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); |
| | | busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); |
| | | } |
| | | catch{ |
| | | busSocket = null; |