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.
Related
When developing a Java EE 7 webapp (Win8, eclipse Kepler, JBoss Tools 4.1.1, wildfly8.0CR) I can use the application at localhost:8080/app/
But I wonder what to do, if I want an extern access to that app, e.g. from my other PC. What configuration is needed, or do you need a "real" server for such a purpose?
Thanks in advance
How public to you want your website to be?
If you want to access it from another computer on the same network(for example your home network) you need to adjust your network and firewall settings so that that you would have access from one computer to anoher on the same network. Then if on the computer that contains the app you would access it for example http://localhost:8080/myapp then on another network you would access it http://ip-of-the-comuter-that-contains-the-app:8080/.
If you would like to access it from outside the local network then the process is same, but a static IP would be recommended to the computer that contains the app.
If you would like the general public to use the app, then hosting it from your PC may not be such a good idea and somekind of server solution is adviseable. There are lots of different cloud solutions like http://aws.amazon.com/ec2/ or https://developers.google.com/appengine/ that would provide enough flexibility for majority of apps. Or you could ofcourse have your own server hardware, but this can turn out to be much more expensive to keep stable and secure.
For a quick-and-dirty solution you can choose the "Enable remote access" option on the server (double click the server, and you should see a check box in the server editor).
This will tell the server to start listening on all network interfaces and not just the local one.
btw. we only listen on local network interface by default for security reasons since we don't want you to unintentionally get hacked if a vulnerability is found and used by someone malicious.
I am posting this in order to confirm if it is possible for PHP to get a user's machine hardware information when connected to a website?
In my case I am developing an Intranet which requires one user - one machine login. Which means a user assigned to his/ her machine can only login, others cannot login from that particular machine. In this regard, my database and PHP Code is already up and running without machine dependency.
I presume it is not possible because PHP is a Server Side code which requires none of the User's system resources to get in touch with. To get system's hardware information - some application must be installed in user's machine to get it done. But is this possible in any regard for example a PHP Desktop application (though not in development) or any Java application to check machine's information and get appended it to Normal user's login.
Awaiting experts solutions...
It depends what information you need. The HTTP Headers contain the user agent (what browers/OS) of the origin, the IP address and a few other things that the server needs in order to process the request, but you can't get for instance the brand of keyboard connected to that machine.
Simple: IMPOSSIBLE! As php will output text to a browser and the browser can gather some data, but only a little (like screen resolution, colors, IP and things that are not vurnelable.). But no, PHP cannot access hardware information.
You can use the IP address to know which machine it is only if your DHCP does not change the IP at each deconnexion.
You can also use the REMOTE_USER_AGENT super global to know more informations. Apart from an ajax request that can send datas that your security policy allows the browser to get, I see no solution for your problem.
My goal is to send data from a PC to a Viewing Station (running Linux, on the same network) so that the user at the Viewing Station (VS) can view a graph of the data. I am not allowed to install any applications on the Viewing Station but it does have a browser (something like Firefox or Chrome).
The only way I could think of doing this is to create a java applet which is opened in the browser (on the viewing station), which reads data from the IP address/ port on the viewing station.
Is this possible? How can I go about doing this? Thanks
edit: I cannot send the data to be graphed, outside of the local network. The data is sent from the PC to a local IP address where the viewing station is located.
Scenario:
PC starts sending data to be graphed, to a fixed IP address (where the viewing station is located).
User opens up a browser in the viewing station and opens something that shows the graph. The graph should contain the data received from a predefined port/IP address.
New values are added every 240ms.
edit2: We have shelved this feature for now so I am unable to try any of the mentioned solutions. Thanks for the input though
If a server-side solution is not practical, I'd look to implement simple graphs using JS and the HTML 5 canvas. For more complex graphs, find a JS API.
If a server-side solution is practical, use JFreeChart (or JCharts etc.) to produce an image on the server-side, then provide that image to the client.
Although browsers may be installed on the client, it does not necessarily mean that Java is installed & enabled in those browsers.
Use JCharts. It allows you to make graphs and charts and display them via servlet, applet, or standalone UI. Code it up into some servlets on your server side and then you can view them on the client browsers.
The main problem with your plan is that you cannot 'push' data to your viewer unless there is a service there to accept it. If you cannot install such a service, your options are limited.
1: Map a network drive. The 'producer' dumps the data here, and the 'viewer' can read it. It is unlikely given your restrictions that you will be allowed to do this.
2: Use any of the graph libraries suggested by others and configure your webserver to restrict access to a whitelist of hosts. Your 'producer' runs a webserver which will only serve pages to a specific IP or subnet, your 'consumer' connects to said webserver. See here or here for setting up a webserver which only allows access from a specific IP.
I am making a website where coworkers can share files with one another.
One user chooses a file on his computer.
He leaves his computer on and that web page open.
Other multiple users can download that specified file from his computer.
Specs:
There are no main servers. The one
user with the file, his computer is
the server,
persay.
It is all done a website, no program
for users to download.
Also, I guess what I mean by no main server is that I dont have to actually buy servers for large files. Basically I want to code a nice, no main server p2p network.
Could I use cirrus?
Would really appreciate any help.
Please & Thanks.
There is no way of implementing P2P without having some central peers facilitating P2P connections.
Moreover, websites are implemented with servers. If your peers are going to run a web service, they need to be localized on the web. You will some kind of central service to accomplish this.
is that I dont have to actually buy servers for large files.
You won't have to. You can serve .torrent files (usually a few kB) from any computer. You could use an open tracker such as http://openbittorrent.com/Open Bittorrent to "use" these bittorrent files. Your employees can then use a torrent client (Vuze, Utorrent, etc.) to download the files...
Another easy way would be using something like Opera Unite.
A web-based, decentralized file sharing the way you mention it, would most likely be very hard to create and maintain.
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.