Java App on Mac asking for allow network connections everytime - java

My Java.app broadcasts a packet on the network as soon as it starts up. Everytime I start this app, the Mac asks me do I want to allow network connections blah..blah.. Can I use info.plist or something to allow network access to this app and not bother the user who has trustingly downloaded and installed my app.
Thanks

You can choose to allow incoming connections for specific services in System Preferences > Security > Firewall.
Addendum: You application will appear only if the user has chosen to "Set access for specific services and applications." It will be added the first time the application attempts to open the port.
Addendum: The application appears with the name java in the Firewall pane. Once the user chooses to accept or deny, the dialog ceases to appear. This simple example is convenient for testing.

If you codesign your app (using the same key across updates) it should work properly with the app-specific firewall on. It seems to be a bug on Apple's side that unsigned java apps are prompted for allowing network connections (even if they don't try to listen to the network) every time they are run.

Related

Remote sharing my app (Android/iOS) to a desktop user

I'm looking for guidance on how to achieve (build) the following:
I have a native App (supported on both Android and iOS)
I have a user 'A' who has the app installed on his phone.
I want another user 'B' to be able to remotely (on a browser) be able to "view" or "take control" of the app being used by user 'A'. So, User A could say "Share with User B" and User B starts seeing a virtual view of the app on User A's phone, and follows as User A navigates around the app.
Basically, some sort of screen sharing on phone, but only limited to my app.
Note that I do not want the user 'A' to install any separate app to share my app. It should be a capability existing/built within my app itself.
To achieve your goal there are smaller problems to take care about, from screen change detection to P2P communication between network nodes.
For iOS there's a Hierarchy Viewer github project that setups HTTP service on device, allowing to preview snapshots of app window using a web browser. Making use of that, you'd still need custom protocols to notify about user touch events and screen changes, which in turn requires effective screen change detector.
Note that this solution assumes no NAT stays between controlling and controlled devices, which is usually a case for local networks. To use the Internet as a medium, you should consider P2P protocols capable of NAT traversal (reffer to STUN protocol for endpoint address recognition and hole punching as a NAT traversal technique).
As a suggestion, how about this? Please note I'm not into this myself, so I might be suggesting something very hard to do.
Create a website that shows the same information as the phone
Make the app have a "server" component
Have the website authenticate and connect to the phone
Have the phone to send over the data from the app to the website, which can then show it in the appropriate fields/positions.
I think what you're looking for is some kind of VNC-like server that would be integrated into your application and serves the content of your application ui on the network. It should be technically feasible, yet it certainly won't be easy !
There are several VNC servers for android ; most but not all requires root access though, probably because they serve the phone screen and not one specific application.

Monitor All Android Devices events remotely

In Android, I can monitor if certain events are triggered through the use of Broadcast Receivers. Are there any tools which let me view ALL events on an android device I am debugging instead of having to add a broadcast receiver to listen to them?
For example, in a Broadcast receiver, I can monitor for a call forwarding event. Is there a way to debug such events outside of having to write additional Android code? My goal is to test that certain events are triggered after UI state changes, and I am not seeing anything obvious in Logcat that communicates which events are being fired.
For example,
with call forwarding I only see cases like below in Logcat.
START u0 {act=android.intent.action.MAIN cmp=com.android.phone/.GsmUmtsCallForwardOptions}
The machine where you run an Android remotely can be any system supported by the Android SDK: Windows, Mac OS X, or Linux. The socket connections is forward from a specified local port to a specified remote port on the device instance.
It is recommended that this machine is on the same network as your development PC, for performance and configuration reasons, but it is also possible to use any remotely located machine if firewalls and routing are configured correctly. You have to follow specified steps that provide you with the necessary settings in your environment configuration that will allow you to have remote debugging.
Alternatively you can also consider using Google chrome remote debugging for Android. The jsHybugger can also offers you a similar tool that will equally allow Android remote debugging.
Indeed you can choose the approach that suits you better.
Otherwise, if what you meant is to listen to event in some application, then this has to be done by yourself by hand, including it to the respective app you want to listen for every single event. Further details on this direction you find here:
Android listen for all events in application
As you can see, Android has a lot of capabilities, but everything come at some cost - i.e. you have to code it. Otherwise, something that could be done according to your suggestion would be kind of an App or an API that would monitor every single event from all Apps currently in your mobile. But if this is what you really want, then in my view such approach would be cumbersome and overload your mobile.

Java: reconnect disconnected network share

Windows XP on reboot doesn't automatically reconnect my network shares, Windows 7 only does it if the wifi connects fast enough, otherwise it fails and leaves them disconnected.
Usually when one of the two behaviors happen I just go to "computer resources" and double click on the network share drive and this automatically reconnects if the network connection is available.
Now how can a Java program try reconnecting the disconnected network shares it needs?
Right now my program simply fails so I have to double click manually the network share's drive and restart my java program.
To map a drive from a command prompt, and have it remain after a reboot, is to make it persistent.No need to write a java program.
[NET USE \computername\share -p]
Or, right click on My Computer, click map network drive, choose the location, and make sure "Reconnect at logon"
Hope this would help you

How do I force Java applications to log onto a network proxy?

I am attempting to run a Java application (specifically Minecraft) at my school on a mac computer. I wish to play online on my personal server, however the way the network is set up here the only way to access the internet is to enter network user/pass (The school uses a websense filter). Each student has one, and when you open a browser window a prompt will automatically ask me for it. The same user/pass is used to log into the machine, and some software will simply pick it up and go online without entering it a second time (ex. Safari just connects, Chrome however prompts for the user/pass).
Java applications however seem to be a mixed bag, some will connect, some will not. However none of them prompt me for the user/pass to the network.
So is there any way to force possibly through command line?) a Java application to log into the network?
Or is there possibly some other problem here?
You can set the proxy at the command line. This should help you: How do I set the proxy to be used by the JVM
In case you can't use your proxy directly you might try and install a local proxy such as CNTLM that connects to your network proxy and authenticates using the credentials you provide. The application would then not have to provide credentials. However, you'd have to provide your network credentials to CNTLM and thus should not forget to remove them when you are done.

How can I code a web app p2p network?

I wanted to code a web application, where one user can choose a file and other multiple users can download that specified file off of that user's computer. That user would have to leave his computer on and leave the web page open.
I dont want to have a big main server that has to handle all that traffic. That user's computer is the server, persay. I understand I'll use torrent.
All this has to be done on a website.
Will a web socket work?
Please and Thanks.
This really isn't possible for a variety of reasons:
Firewalls / NATs
Dynamic IPs
No "server" running on the user's machines
Permissions on the user's machine
What happens if the user simply deletes the file on their machine?
To actually make it work you'd have to:
Convince the user to install the app on their machine (you'd need a windows/linux/... EXE)
Get the user to open a port in the firewall (or use some library to enable NAT passthru)
Have the user's PC ping your server in the event the user's IP changes
On the server side, you'd have to keep several database tables, here are few I can think of off the top of my head:
A user's table (user ID [PK], Current IP, Communications Port, (maybe some other tracking things))
Available downloads table (download ID [PK], user ID [FK])
Then when someone wants to go off and download, you have to (probably) launch your app with the requisite arguments (remote user's IP/port/file ID) and have that do the work of the download.
This is by no means an easy feat.
If by WebSockets you mean the HTML5 variety, I'd stay away from that. http://en.wikipedia.org/wiki/WebSockets#Browser_support
The the computer that has to stay on, is basically your server. Even if it isn't a big server somewhere.
My suggestion would be to install apache or some other small web server on each users computer and have have a dyndns address for each computer so you can find each other. it would be much easier than coding something. especially if it has to be through a web page.
You could use a c# client library to interface to bittorrent or etc and use this mode to upload/leach. As far as NAT/Firewall issues go they are well documented and a function of the protocol being used, ie deal with it.

Categories