Exemple #1
0
 public virtual void readFromInetAddress(InetAddress inetAddress)
 {
     sin_len    = @sizeof();
     sin_family = sceNetInet.AF_INET;
     sin_port   = 0;
     sin_addr   = sceNetInet.bytesToInternetAddress(inetAddress.Address);
 }
Exemple #2
0
 public virtual void readFromInetAddress(InetAddress inetAddress, pspNetSockAddrInternet netSockAddrInternet)
 {
     sin_len    = @sizeof();
     sin_family = netSockAddrInternet != null ? netSockAddrInternet.sin_family : sceNetInet.AF_INET;
     sin_port   = netSockAddrInternet != null ? netSockAddrInternet.sin_port : 0;
     sin_addr   = sceNetInet.bytesToInternetAddress(inetAddress.Address);
 }
Exemple #3
0
        /// <summary>
        /// 获取链接到当前热点的设备IP:
        /// </summary>
        public static List <WifiApStateViewModel> GetConnectedHotIp()
        {
            var    result = new List <WifiApStateViewModel>();
            var    fr     = new FileReader("/proc/net/arp");
            var    br     = new BufferedReader(fr);
            string line;

            while ((line = br.ReadLine()) != null)
            {
                var splitted = Regex.Split(line, " +");
                if (splitted.Length < 4 || splitted[0] == "IP")
                {
                    continue;
                }
                var es    = Executors.NewCachedThreadPool();
                var model = new WifiApStateViewModel()
                {
                    Ip    = splitted[0],
                    State = splitted[2]
                };
                es.Submit(new Runnable(() =>
                {
                    var ip = InetAddress.GetByName(splitted[0]);
                    if (ip.IsReachable(1000))
                    {
                        model.State = "1";
                    }
                }));
                result.Add(model);
            }
            fr.Close();
            br.Close();
            return(result);
        }
Exemple #4
0
        public virtual void testParseSocketAddressToString()
        {
            string localhostName;
            string localIP;

            try
            {
                InetAddress inetAddress = InetAddress.LocalHost;
                localhostName = inetAddress.HostName;
                localIP       = inetAddress.HostAddress;
                if (null == localIP || string.IsNullOrWhiteSpace(localIP))
                {
                    return;
                }
            }
            catch (UnknownHostException)
            {
                localhostName = "localhost";
                localIP       = "127.0.0.1";
            }
            IPEndPoint socketAddress = new IPEndPoint(localhostName, port);
            string     res           = RemotingUtil.parseSocketAddressToString(socketAddress);

            Assert.Equal(localIP + ":" + port, res);
        }
Exemple #5
0
        /// <summary>
        /// Tests if a host name is pingable
        /// </summary>
        /// <param name="host">The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address (127.0.0.1)</param>
        /// <param name="msTimeout">Timeout in milliseconds</param>
        /// <returns></returns>
        public override async Task <bool> IsReachable(string host, int msTimeout = 5000)
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host");
            }

            if (!IsConnected)
            {
                return(false);
            }

            return(await Task.Run(() =>
            {
                bool reachable;
                try
                {
                    reachable = InetAddress.GetByName(host).IsReachable(msTimeout);
                }
                catch (UnknownHostException ex)
                {
                    Debug.WriteLine("Unable to reach: " + host + " Error: " + ex);
                    reachable = false;
                }
                catch (Exception ex2)
                {
                    Debug.WriteLine("Unable to reach: " + host + " Error: " + ex2);
                    reachable = false;
                }
                return reachable;
            }));
        }
Exemple #6
0
            public override void run()
            {
                Console.WriteLine(string.Format("Starting AutoDetectJpcsp ListenerThread"));
                sbyte[] response = new sbyte[256];

                while (!exit_Renamed)
                {
                    try
                    {
                        InetAddress     listenAddress = InetAddress.getByName(multicastIp);
                        MulticastSocket socket        = new MulticastSocket(discoveryPort);
                        socket.joinGroup(listenAddress);
                        while (!exit_Renamed)
                        {
                            DatagramPacket packet = new DatagramPacket(response, response.Length);
                            socket.receive(packet);
                            processRequest(socket, new string(packet.Data, packet.Offset, packet.Length), packet.Address, packet.Port);
                        }
                        socket.close();
                    }
                    catch (IOException e)
                    {
                        Console.WriteLine("ListenerThread", e);
                        exit();
                    }
                }
            }
            public IP4Header(ByteBuffer buffer)
            {
                try
                {
                    byte versionAndIHL = (byte)buffer.Get();
                    this.version      = (byte)(versionAndIHL >> 4);
                    this.IHL          = (byte)(versionAndIHL & 0x0F);
                    this.headerLength = this.IHL << 2;

                    this.typeOfService = BitUtils.GetUnsignedByte((byte)buffer.Get());
                    this.totalLength   = BitUtils.GetUnsignedShort(buffer.Short);

                    this.identificationAndFlagsAndFragmentOffset = buffer.Int;

                    this.TTL            = BitUtils.GetUnsignedByte((byte)buffer.Get());
                    this.protocolNum    = BitUtils.GetUnsignedByte((byte)buffer.Get());
                    this.protocol       = (TransportProtocol)protocolNum;
                    this.headerChecksum = BitUtils.GetUnsignedShort(buffer.Short);

                    byte[] addressBytes = new byte[4];
                    buffer.Get(addressBytes, 0, 4);
                    this.sourceAddress = InetAddress.GetByAddress(addressBytes);

                    buffer.Get(addressBytes, 0, 4);
                    this.destinationAddress = InetAddress.GetByAddress(addressBytes);

                    //this.optionsAndPadding = buffer.getInt();
                }
                catch
                {
                    throw new UnknownHostException();
                }
            }
        public async Task <bool> IsPingReachable(string host, int msTimeout = 5000)
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host");
            }

            if (!IsConnected)
            {
                return(false);
            }

            return(await Task.Run(() =>
            {
                bool reachable;
                try
                {
                    reachable = InetAddress.GetByName(host).IsReachable(msTimeout);
                }
                catch (UnknownHostException)
                {
                    reachable = false;
                }
                return reachable;
            }));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="address"></param>
        public void AddEndPoint(Uri uri, InetAddress address)
        {
            // Adds the given endpoint to the socket address and starts the
            // listening/writing cycle
            IPEndPoint remoteAddress = new IPEndPoint(uri.GetIPAddress(), uri.Port);

            /*
             * TODO FIXME probably the new TransactionManager isn't needed, however
             * i'll still create it but copy the values needed for automatic testing
             * SubIssue #1
             */
            /*bool testingOld = false;
             *
             * string presetTidOld = "";
             * // -- start of the code that enables a transaction test.
             * if (transactionManager != null)
             * {
             *  testingOld = transactionManager.testing;
             *  presetTidOld = transactionManager.presetTID;
             * }
             * transactionManager = new TransactionManager(this);
             * transactionManager.testing = testingOld;
             * transactionManager.presetTID = presetTidOld;
             * // -- end of the code that enables a transaction test.*/

            _socket.Connect(remoteAddress);
            Connections connectionsInstance = MSRPStack.GetConnectionsInstance(address);

            _ioOperationGroup = new ThreadGroup(connectionsInstance.ConnectionsGroup, string.Format("IO OP connection {0} group", uri.ToString()));
            connectionsInstance.StartConnectionThread(this, _ioOperationGroup);
        }
Exemple #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="address"></param>
        public Connections(InetAddress address)
        {
            try
            {
                _random = new Random();

                if (NetworkUtils.isLinkLocalIPv4Address(address._addr))
                {
                    _logger.Info(string.Format("Connections: given address is a local one: {0}", address));
                }

                _serverSocketChannel = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); //SelectorProvider.provider().openServerSocketChannel();
                _serverSocketChannel.Bind(new IPEndPoint(address._addr, 0));
                _serverSocketChannel.Listen(10);                                                                    //TODO: backlog uitzoeken wat is de beste waarde ?

                // fill the localURI variable that contains the uri parts that are
                // associated with this connection (scheme[protocol], host and port)
                //Uri newLocalURI = new Uri("msrp", null, address.getHostAddress(), socket.getLocalPort(), null, null, null);
                IPEndPoint endpoint = (IPEndPoint)_serverSocketChannel.LocalEndPoint;

                Uri newLocalURI = new Uri(string.Format("msrp://{0}:{1}", endpoint.Address.ToString(), endpoint.Port.ToString()));

                LocalURI = newLocalURI;
                Thread server = new Thread(new ThreadStart(ThreadRun)); //new Thread(this);
                server.Name = string.Format("Connections: {0} server", LocalURI);
                server.Start();
            }
            catch (Exception ex) { }
        }
Exemple #11
0
        internal virtual URI GetURI(InetSocketAddress socketAddress)
        {
            string uri;

            InetAddress address = socketAddress.Address;

            if (address is Inet6Address)
            {
                uri = CLUSTER_SCHEME + "://" + WrapAddressForIPv6Uri(address.HostAddress) + ":" + socketAddress.Port;
            }
            else if (address is Inet4Address)
            {
                uri = CLUSTER_SCHEME + "://" + address.HostAddress + ":" + socketAddress.Port;
            }
            else
            {
                throw new System.ArgumentException("Address type unknown");
            }

            // Add name if given
            if (!string.ReferenceEquals(_config.name(), null))
            {
                uri += "/?name=" + _config.name();
            }

            return(URI.create(uri));
        }
Exemple #12
0
        public virtual void discover()
        {
            try
            {
                igd = new IGD();
                ListenerThread listener = new ListenerThread(this, igd);
                listener.Daemon = true;
                listener.Name   = "UPnP Discovery Listener";
                listener.Start();
                while (!listener.Ready)
                {
                    Utilities.sleep(100);
                }

                foreach (string device in deviceList)
                {
                    string discoveryRequest = string.Format("M-SEARCH * HTTP/1.1\r\nHOST: {0}:{1:D}\r\nST: {2}\r\nMAN: \"ssdp:discover\"\r\nMX: {3:D}\r\n\r\n", multicastIp, discoveryPort, device, discoveryTimeoutMillis / 1000);
                    IEnumerator <NetworkInterface> networkInterfaces = NetworkInterface.NetworkInterfaces;
                    while (networkInterfaces.MoveNext())
                    {
                        NetworkInterface networkInterface = networkInterfaces.Current;
                        if (networkInterface.Up && networkInterface.supportsMulticast())
                        {
                            for (IEnumerator <InetAddress> addresses = networkInterface.InetAddresses; addresses.MoveNext();)
                            {
                                InetAddress address = addresses.Current;
                                if (address is Inet4Address && !address.LoopbackAddress)
                                {
                                    MulticastSocket   socket        = new MulticastSocket(new InetSocketAddress(address, discoverySearchPort));
                                    InetSocketAddress socketAddress = new InetSocketAddress(multicastIp, discoveryPort);
                                    DatagramPacket    packet        = new DatagramPacket(discoveryRequest.GetBytes(), discoveryRequest.Length, socketAddress);
                                    socket.send(packet);
                                    socket.disconnect();
                                    socket.close();
                                }
                            }
                        }
                    }
                }

                for (int i = 0; i < discoveryTimeoutMillis / 10; i++)
                {
                    if (listener.Done)
                    {
                        break;
                    }
                    Utilities.sleep(10, 0);
                }

                listener.Done = true;
                while (!listener.Ready)
                {
                    Utilities.sleep(100);
                }
            }
            catch (IOException e)
            {
                Console.WriteLine("discover", e);
            }
        }
        /// <summary>
        /// Ask the authenticator that has been registered with the system
        /// for a password.
        /// <para>
        /// First, if there is a security manager, its {@code checkPermission}
        /// method is called with a
        /// {@code NetPermission("requestPasswordAuthentication")} permission.
        /// This may result in a java.lang.SecurityException.
        ///
        /// </para>
        /// </summary>
        /// <param name="addr"> The InetAddress of the site requesting authorization,
        ///             or null if not known. </param>
        /// <param name="port"> the port for the requested connection </param>
        /// <param name="protocol"> The protocol that's requesting the connection
        ///          (<seealso cref="java.net.Authenticator#getRequestingProtocol()"/>) </param>
        /// <param name="prompt"> A prompt string for the user </param>
        /// <param name="scheme"> The authentication scheme
        /// </param>
        /// <returns> The username/password, or null if one can't be gotten.
        /// </returns>
        /// <exception cref="SecurityException">
        ///        if a security manager exists and its
        ///        {@code checkPermission} method doesn't allow
        ///        the password authentication request.
        /// </exception>
        /// <seealso cref= SecurityManager#checkPermission </seealso>
        /// <seealso cref= java.net.NetPermission </seealso>
        public static PasswordAuthentication RequestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)
        {
            SecurityManager sm = System.SecurityManager;

            if (sm != null)
            {
                NetPermission requestPermission = new NetPermission("requestPasswordAuthentication");
                sm.CheckPermission(requestPermission);
            }

            Authenticator a = TheAuthenticator;

            if (a == null)
            {
                return(null);
            }
            else
            {
                lock (a)
                {
                    a.Reset();
                    a.RequestingSite_Renamed     = addr;
                    a.RequestingPort_Renamed     = port;
                    a.RequestingProtocol_Renamed = protocol;
                    a.RequestingPrompt_Renamed   = prompt;
                    a.RequestingScheme_Renamed   = scheme;
                    return(a.PasswordAuthentication);
                }
            }
        }
Exemple #14
0
        internal static PortWatcher getPort(Session session, String address, int lport)
        {
            InetAddress addr;

            try
            {
                addr = InetAddress.getByName(address);
            }
            catch (Exception)
            {
                throw new JSchException("PortForwardingL: invalid address " + address + " specified.");
            }
            lock (pool)
            {
                for (int i = 0; i < pool.size(); i++)
                {
                    var p = (PortWatcher)(pool.elementAt(i));
                    if (p.session == session && p.lport == lport)
                    {
                        if (p.boundaddress.isAnyLocalAddress() ||
                            p.boundaddress.equals(addr))
                        {
                            return(p);
                        }
                    }
                }
                return(null);
            }
        }
Exemple #15
0
        private void ConnectionCheckRunner()
        {
            while (true)
            {
                try
                {
                    var addr = InetAddress.GetByName("192.168.1.248");

                    if (addr.IsReachable(50))
                    {
                        RunOnUiThread(() => _dronStateTextView.SetBackgroundColor(new Color(0, 255, 0)));
                    }
                    else
                    {
                        RunOnUiThread(() => _dronStateTextView.SetBackgroundColor(new Color(255, 0, 0)));
                    }

                    Thread.Sleep(100);
                }
                catch (UnknownHostException)
                {
                    RunOnUiThread(() => _dronStateTextView.SetBackgroundColor(new Color(255, 0, 0)));
                }
                catch (IOException)
                {
                    RunOnUiThread(() => _dronStateTextView.SetBackgroundColor(new Color(255, 0, 0)));
                }
            }
        }
        private void SetButtonClick(object sender, EventArgs e)
        {
            IpConfiguration ipConfiguration = GetConf();

            if (ipConfiguration == null)
            {
                return;
            }

            if (radio_dhcp.Checked)
            {
                SetConf(new IpConfiguration(IpConfiguration.IpAssignment.Dhcp, null, IpConfiguration.ProxySettings.Unassigned, null));
            }
            else if (radio_static.Checked)
            {
                List <InetAddress> dnsList = new List <InetAddress>();
                dnsList.Add(InetAddress.GetByName(dns.Text));
                IpConfiguration ipConf = new IpConfiguration(
                    IpConfiguration.IpAssignment.Static,
                    new StaticIpConfiguration(ipaddress.Text, InetAddress.GetByName(gateway.Text), dnsList, null),
                    IpConfiguration.ProxySettings.Unassigned,
                    null);

                SetConf(ipConf);
            }
        }
Exemple #17
0
        public static IPHostEntry GetHostEntry(string hostNameOrAddress)
        {
            var a = default(InetAddress[]);

            try
            {
                a = InetAddress.getAllByName(hostNameOrAddress);
            }
            catch
            {
                throw new InvalidOperationException();
            }

            var z = new __IPAddress[a.Length];

            for (int j = 0; j < a.Length; j++)
            {
                z[j] = new __IPAddress {
                    InternalAddress = a[j]
                };
            }

            var i = new __IPHostEntry();

            i.AddressList = (IPAddress[])(object)z;

            return((IPHostEntry)(object)i);
        }
Exemple #18
0
        private static string DetermineMacAddress()
        {
            string formattedMac = "0";

            try
            {
                InetAddress      address = InetAddress.LocalHost;
                NetworkInterface ni      = NetworkInterface.getByInetAddress(address);
                if (ni != null)
                {
                    sbyte[] mac = ni.HardwareAddress;
                    if (mac != null)
                    {
                        StringBuilder sb        = new StringBuilder(mac.Length * 2);
                        Formatter     formatter = new Formatter(sb);
                        foreach (sbyte b in mac)
                        {
                            formatter.format("%02x", b);
                        }
                        formattedMac = sb.ToString();
                    }
                }
            }
            catch (Exception)
            {
                //
            }

            return(formattedMac);
        }
Exemple #19
0
        public static PortWatcher getPort(Session session, String address, int lport)
        {
            InetAddress addr;

            try
            {
                addr = new InetAddress(Dns.GetHostEntry(address).AddressList[0]);
            }
            catch (Exception uhe)
            {
                throw new JSchException("PortForwardingL: invalid address " + address + " specified.", inner: uhe);
            }

            lock (pool)
            {
                for (int i = 0; i < pool.Count; i++)
                {
                    PortWatcher p = (PortWatcher)(pool[i]);

                    if (p.session == session && p.lport == lport)
                    {
                        if (p.boundaddress.isAnyLocalAddress() || p.boundaddress.equals(addr))
                        {
                            return(p);
                        }
                    }
                }
                return(null);
            }
        }
 public void setDestination(InetAddress dest, int dport)
 {
     mTransport    = RtpSocket.TRANSPORT_UDP;
     mPort         = dport;
     upack.Port    = dport;
     upack.Address = dest;
 }
        //---------- main

        /**
         * Runs the discoverer and shows a message dialog with the returned report.
         * @param args args[0] - stun server address, args[1] - port. in the case of
         * no args - defaults are provided.
         * @throws java.lang.Exception if an exception occurrs during the discovery
         * process.
         */
#if false
        public static void main(String[] args)
        {
            StunAddress localAddr  = null;
            StunAddress serverAddr = null;

            if (args.Length == 4)
            {
                localAddr  = new StunAddress(args[2], Integer.valueOf(args[3]).intValue());
                serverAddr = new StunAddress(args[0],
                                             Integer.valueOf(args[1]).intValue());
            }
            else
            {
                localAddr  = new StunAddress(InetAddress.getLocalHost(), 5678);
                serverAddr = new StunAddress("stun01bak.sipphone.com.", 3479);
            }
            NetworkConfigurationDiscoveryProcess addressDiscovery =
                new NetworkConfigurationDiscoveryProcess(localAddr, serverAddr);

            addressDiscovery.start();
            StunDiscoveryReport report = addressDiscovery.determineAddress();

            System.oout.println(report);
//        javax.swing.JOptionPane.showMessageDialog(
//                null,
//                report.toString(),
//                "Stun Discovery Process",
//                javax.swing.JOptionPane.INFORMATION_MESSAGE);
            System.exit(0);
        }
Exemple #22
0
        static void Main(string[] args)
        {
            Runtime.getRuntime().addShutdownHook(new Thread(Run));
            ConsoleWriter.clear();
            ConsoleWriter.setTitle("Cyon Remake - Cargando...");
            ConsoleWriter.println("==============================================================\n");
            ConsoleWriter.println(makeHeader());
            ConsoleWriter.println("==============================================================\n");
            ConsoleWriter.println("Cargando la configuracion..");
            loadConfiguration();
            isInit = true;
            ConsoleWriter.println("configuracion lista.");
            ConsoleWriter.println("Conectandose con MySQL server.");
            if (SQLManager.setUpConnexion())
            {
                ConsoleWriter.println("Conexion lista.");
            }
            else
            {
                ConsoleWriter.println("Conexion invalida.");
                closeServers();
                Environment.Exit(0);
            }
            ConsoleWriter.println("Creando el mundo.\n");
            var startTime = TimeSpan.FromMilliseconds(Environment.TickCount); //System.currentTimeMillis();

            World.createWorld();
            var differenceTime = startTime.ToString("ss");

            ConsoleWriter.println("\nEmulator listo en : " + differenceTime + " s");
            isRunning = true;
            ConsoleWriter.println("==============================================================\n");
            //ConsoleWriter.println("Esperando conexiones entrantes, puerto de juego: " + CONFIG_GAME_PORT);
            string Ip = "";

            try
            {
                Ip = InetAddress.getLocalHost().getHostAddress();
            }
            catch (Exception e)
            {
                ConsoleWriter.println(e.Message);
                try
                {
                    Thread.Sleep(10000);
                }
                catch (Exception e1) { }
                Console.ReadKey();
                Environment.Exit(1);
            }
            Ip         = IP;
            gameServer = new GameServer(Ip);

            realmServer = new RealmServer();
            ConsoleWriter.println("IP du serveur: " + IP);
            //refreshTitle();
            //EmuStart();¿
            GC.Collect();
        }
Exemple #23
0
        public bool Equals(PeerSocketAddress other)
        {
            var t1 = InetAddress.Equals(other.InetAddress);
            var t2 = TcpPort.Equals(other.TcpPort);
            var t3 = UdpPort.Equals(other.UdpPort);

            return(t1 && t2 && t3);
        }
Exemple #24
0
 public PacketEvent(DatagramPacket packet)
 {
     address = packet.getAddress();
     port    = packet.getPort();
     data    = packet.getData();
     length  = packet.getLength();
     //        Log.d("PacketEvent"," p:"+packet.getLength()+ " d:"+data.length);
 }
Exemple #25
0
 private void addToOutboundQueue(byte[] data, Bundle rinfo)
 {
     try {
         outboundQueue.add(new DatagramPacket(data, data.length, InetAddress.getByName(rinfo.getString(com.disappointedpig.midi.MIDIConstants.RINFO_ADDR)), rinfo.getInt(com.disappointedpig.midi.MIDIConstants.RINFO_PORT)));
         selector.wakeup();
     } catch (UnknownHostException e) {
         e.printStackTrace();
     }
 }
Exemple #26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void connect() throws java.io.IOException
            public virtual void connect()
            {
                openChannel();
                if (!socketChannel.Connected && !socketChannel.ConnectionPending)
                {
                    SocketAddress socketAddress = new InetSocketAddress(InetAddress.getByAddress(destinationIPAddress), destinationPort);
                    socketChannel.connect(socketAddress);
                }
            }
Exemple #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void testGetHostAddressUnknown()
        internal virtual void TestGetHostAddressUnknown()
        {
            // Given
            string unknownHost = "unknownHost";

            assertThrows(typeof(UnknownHostException), () => InetAddress.getByName(unknownHost));

            // should return hostname when it is unknown
            assertThat(HostnamePort.GetHostAddress(unknownHost, "default"), equalTo(unknownHost));
        }
Exemple #28
0
 private void AddToOutboundQueue(byte[] data, Bundle rinfo)
 {
     try {
         outboundQueue.Enqueue(new DatagramPacket(data, data.Length,
                                                  InetAddress.GetByName(rinfo.GetString(midi.MIDIConstants.RINFO_ADDR)), rinfo.GetInt(midi.MIDIConstants.RINFO_PORT)));
         selector.Wakeup();
     } catch (UnknownHostException e) {
         throw new UnknownHostException(e.StackTrace);
     }
 }
        public static bool?registerUserBySerial(Session paramSession, string paramString1, string paramString2, string paramString3)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            bool? @bool = Convert.ToBoolean(false);

            System.Collections.IList list = paramSession.createQuery("from ConcLicenseTable").list();
            XStream xStream = new XStream();
            License license = new License();

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.hasSameSerial(paramString3).Value&& !licenseRowItem.CheckedIn)
                {
                    try
                    {
                        bool?bool1 = Convert.ToBoolean(false);
                        System.Collections.IEnumerator enumeration = NetworkInterface.NetworkInterfaces;
                        List <object> arrayList = new List <object>();
                        foreach (NetworkInterface networkInterface in Collections.list(enumeration))
                        {
                            foreach (InetAddress inetAddress in Collections.list(networkInterface.InetAddresses))
                            {
                                arrayList.Add(inetAddress);
                                if (inetAddress.HostAddress.equalsIgnoreCase(licenseRowItem.ServerIP))
                                {
                                    bool1 = Convert.ToBoolean(true);
                                    InetAddress inetAddress1 = inetAddress;
                                }
                            }
                        }
                        if (!bool1.Value)
                        {
                            @bool = Convert.ToBoolean(false);
                            break;
                        }
                    }
                    catch (SocketException socketException)
                    {
                        Console.WriteLine(socketException.ToString());
                        Console.Write(socketException.StackTrace);
                    }
                    DateTime         date             = DateTime.Now;
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyyMMddHHmmssZ");
                    string           str1             = simpleDateFormat.format(date);
                    LicenseRowItem   licenseRowItem1  = createRow(paramString1, paramString2, paramString3, licenseRowItem, Convert.ToBoolean(true), str1);
                    string           str2             = xStream.toXML(licenseRowItem1);
                    concLicenseTable.HashKey = str2;
                    paramSession.update(concLicenseTable);
                    @bool = Convert.ToBoolean(true);
                }
            }
            paramSession.flush();
            return(@bool);
        }
Exemple #30
0
 private static InetAddress InetAddress(string address)
 {
     try
     {
         return(InetAddress.getByName(address));
     }
     catch (java.net.UnknownHostException e)
     {
         throw new UnknownHostException(e);
     }
 }
Exemple #31
0
 // Synchronization is unnecessary since the code only calls a synchronized method
 public bool SendTo(byte[] bytes, int offset, int size, InetAddress ipAddress, int port)
 {
     return this.SendTo(bytes, offset, size, ipAddress.GetHostAddress(), port);
 }
Exemple #32
0
 public TcpSendDataHandler(Topic t, string localInterface)
 {
     sender = new TcpServerSender(t.GetDomainAddress(), t.GetPort(), t.GetOutSocketBufferSize());
     sinkIP = InetAddress.GetByName(t.GetDomainAddress());
 }
 public DatagramPacket(byte[] var2, int length, InetAddress var3, int i)
 {
     throw new System.NotImplementedException();
 }
Exemple #34
0
 public McSendDataHandler(Topic t, string localInterface)
 {
     sender = new MulticastSender(0, localInterface, 1, t.GetOutSocketBufferSize());     // Make ttl configurable
     sinkIP = InetAddress.GetByName(t.GetDomainAddress());
 }
Exemple #35
0
 public bool SendTo(byte[] bytes, int offset, int size, InetAddress ipAddress, int port)
 {
     return tcpSenderList.SendTo(bytes, offset, size, ipAddress, port);
 }
Exemple #36
0
        public bool SendTo(byte[] bytes, int offset, int size, InetAddress ipAddress, int port)
        {
            try
            {
                IPEndPoint ipep = new IPEndPoint(ipAddress.GetIPAddress(), port);

                // "UdpClient" do not include a send method with an offset.
                // Hence we must use the underlaying socket "Client" to be able to
                // send a byte buffer starting with an offset
                multicastSocket.Client.SendTo(bytes, offset, size, SocketFlags.None, (EndPoint)ipep);

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
 public void LeaveGroup(InetAddress broadcastAddress)
 {
     throw new System.NotImplementedException();
 }
 public void leaveGroup(InetAddress arg0)
 {
     Instance.CallMethod("leaveGroup", "(Ljava/net/InetAddress;)V", arg0);
 }
Exemple #39
0
 public ServerSocket(int par3, int i, InetAddress par2InetAddress)
 {
     throw new System.NotImplementedException();
 }
 public DatagramSocket(int queryPort, InetAddress getByName)
 {
     throw new System.NotImplementedException();
 }
 public void setInterface(InetAddress arg0)
 {
     Instance.CallMethod("setInterface", "(Ljava/net/InetAddress;)V", arg0);
 }