How to get and set values from a UPS device using SNMP? - java

I have a java web application running in my workplace.
I was asked to create a new application to "communicate" with network devices and read their statuses.
As an example I started working with a UPS, which is connected to my network with its own Network Interface Card.
I can monitor its status and details with its built-on platform entering with its IP address on a browser. But the idea is to add some of these details to the original web application.
To my understanding I can use a SNMP library for Java and create an application to get and set values to it. In my case i'm using the SNMP4j(V3) library, I imported it to Eclipse (IDE), but have no idea on how to continue from there really.

Related

How to make a local test server for an android app?

I basically need to create a test server, something that I can use locally to perform tasks for my application.
So my android app is basically a search engine, however the search queries will be made on the server and the results then fetched from the server on the mobile device as JSON objects.
Is there any way to replicate this functionality locally? I would just like to set up a server, include the Spring framework, the Google Custom Search API and develop it all in Java, then ship it to a live server directly when it's finished. (Most presumably a free tier Amazon AWS server, either EC2 or Lambda, not sure what the difference is).
Not quite sure where or how to get started so any help is appreciated, thank you!
p.s. I may try dabbling in some machine learning at a later date, but I don't know if this will affect anything, this will most likely be after I've got a live server up and running.
EDIT: Sorry, so how would I fetch data from a local server from my mobile device? Do I need special software? Do I need to configure a local server? How can my mobile device fetch data from a second project when its being run on the first?
My app will fetch data from a server, so how can I create a dummy server, for it to fetch data from? Will I need to create a fully functioning online server, or can this just be done through creating a local server of some sort and then simply plugging my android device in and running the code? I have absolutely no idea how to test it without putting it online.
You can run a local installation of Tomcat server on your own machine.
Access the server by visiting "http://localhost:8080/" (or) http://127.0.0.1:8080". You can basically listening to your own local machine / host's 8080 port. Sometimes, it could be port 80 instead of 8080.
Please explore on how to host a Spring or Java application on a local server.
A good starting point would be to learn J2EE or Enterprise Java. You can configure Databases from your local installation.
If you opt for PHP as your language on server side, there is a pre-defined package called WAMP (for Windows), LAMP (for Linux), MAMP (for MAC) and XAMPP.
The above package are nothing but a package which contains a Server, Database and a Server side language usually PHP, if needed Python or Perl.
Please explain in which step you are getting issues so that anyone can help you exactly.

How to host a java application (without using webservices)

I made a game with sockets that works fine on my machine, and now I would like to run the server on a host so that anyone can join in at any time.
All I'm finding are services for web applications, mine is just a swing application that can run by itself.
What kind of server can I use (instead of my own machine)? Would I need to change the code or is it possible to just find a host that runs my server application as is?
Also, note that for now I kept it simple, there is no data storage.
Take a look at Amazon EC2 cloud. Essentially what you're looking to do is acquire a public IP address (an be done from the Amazon EC2 admin console). You'll be installing java and then opening a port in your security settings to allow traffic to whatever port your game server is running on.
EC2 is free for low volumes of usage for the first year (new accounts only) and I've had fairly good luck with them in terms of downtime and affordability.

server registers ip of my modem continously to use it in my android application

Initially, ip-addresses from the ISP are always changing. I am working on an android app and I need to connect from outside my home to my internal network. I need a server connected to my modem/router and the server should save the public ip of my home network every time it changes.
Goal: make a communication between my android app and the modem/router.
My question is:
Do I have to program an app on the server side to do this job, or is there an app already available?
If none are available, could you please tell me the steps to create one, or any references to that end?
Thank you!
I think your best bet is to use a dynamic dns service. That will allow you to give your machine a string name, run the app they'll give you (or many routers support this built-in), and just reference the computer by name when you need it. See http://en.wikipedia.org/wiki/Dynamic_DNS

Getting which application uses a specific port on android

I have an android native application which hosts a web server inside it.
I want to know which application makes requests before they are processed by my application.
What I have is the port of the calling application.
How can I find out which application is using this port?
I've tried looking for all processes (cat /proc/net/tcp6), but the application with the port I have is not listed (on a rooted device it is).
I also tried playing with lots of options of the netstat command, but I don't get any valuable information.
I need to find a way to find the calling application name on a regular device (not rooted).
The uid is a field in /proc/net/tcp6, which at least of the moment is readable from an unprivileged app.
Then you can use PackageManager.getNameForUid()
That said, your goal seems like an odd design.

How to access Android from browser

I have seen a few applications recently called lazyview and airdroid on Android, that connect via wireless to any browser, using local ip address and port. The things they access can be applications, battery view, basically most settings including video photos etc, not just the file structures. Does anyone know how this is done, or if there is any open source code that can do this.
You need to build a webserver in your application. For example: Tiny Java Webserver, i-jetty

Categories

Resources