NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 23, 2017, 07:45:29 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"Make priority, take action and start now." ...Wisdom
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: EJS can not access the network?  (Read 5089 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
on: March 25, 2011, 03:44:03 pm » posted from:Jinan,Shandong,China

EJS can not access the network?
For example, visit the Web site through the HTTP protocol´╝îOr access Ethernet through the TCP/IP protocol.


thanks
 Smiley
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: March 25, 2011, 09:02:59 pm » posted from:Taipei,T\'ai-pei,Taiwan

Do you mean access the EJS examples from within the EJS?
May be it is the antivirus software or firewall software restrict the access to the internet from java.
You need to check your setting in your computer.
Logged
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
Reply #2 on: March 26, 2011, 09:34:01 am » posted from:Jinan,Shandong,China

I'm so sorry,My expression isn't clear enough. My mean is:
Can EJS generate's Simulation program access the network?
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: March 26, 2011, 10:57:06 am » posted from:Taipei,T'ai-pei,Taiwan

There are build in java function which can do the job.
For example:
There is a GUI element in EJS can get image from webcam (if you provide IP of the webcam as property for that GUI element).

Please explain in detail what you want to do.
Logged
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
Reply #4 on: March 26, 2011, 02:27:58 pm » posted from:Jinan,Shandong,China

I would like to send a page request to the site, and then receives the returned HTML code from the site.
For example:
Send "http://www.google.com" to the Google website and receive this page's HTML code (not display this page.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #5 on: March 26, 2011, 03:43:52 pm » posted from:Taipei,T'ai-pei,Taiwan

A web server reader sends commands to an HTTP web server and reads its response.
Usage:
To add a web server reader element to your model, drag the icon element to the list of your model elements and set the "Server address" field to the base URL of your server or link it to a String model variable (as in %myServerURLString%) that will contain it.

A web server reader element does not connect to the web server until you instruct it to do so (in any suitable part) in your model code.

A call to the element method String readOutput(String _command) will send the _command string appened to the server address and will read teh server's output. This makes it easy to send PHP commands to a given server or read different pages from the same server. The method returns a String with the server response to the command, or null if there was any error in the process.

A call to the element method String getServerAddress() returns the address actually used by the element.

You can also change the server address programmatically, using the method setServerAddress(String _serverAddress) . This sets the server address to a constant String (such as "http://www.um.es") or links it to a String model variable (such as "%myURLStringVariable%") which will need to provide the correct URL value.

Notice that the element will correct the URL of the final command sent to the server. For instance, spaces are replaced by the more correct %20 special character combination. Similarly, 'and' characters (&) are replaced by %26.
Example of use
The following code reads the last version of EJS as indicated in the EJS wiki. (Notice that the call to setServerAddress can be removed by editing the element's properties.)

webReader.setServerAddress("http://www.um.es/fem/EjsWiki");
String responseStr = webReader.readOutput("/Site/EjsCurrentVersion?action=source");
if (responseStr==null) {
  _println("Could not read response from "+webReader.getServerAddress());
  return;
}
_println("EJS current version is " + responseStr);
  


You might want to check out: HTTPclient if you need more avvanced functions.
You can use it within EJS. However, EJS is not designed to display html page.
Logged
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
Reply #6 on: March 26, 2011, 08:09:47 pm » posted from:Jinan,Shandong,China

You answer are very helpful for me.
This is what I need!
Thank you very much!

Logged
Pages: [1]   Go Up
  Print  
"Make priority, take action and start now." ...Wisdom
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
send me all applet
Comment about this web site!
5 22272 Last post August 13, 2010, 11:35:23 am
by icetreat
Can you send me the 2d collision applet source code?
Comment about this web site!
4 18891 Last post August 13, 2010, 11:38:09 am
by icetreat
Mirror site at http://www.znanje.org/
Mirror sites and different language versions
Fu-Kwun Hwang 0 20751 Last post September 14, 2005, 11:34:43 am
by Fu-Kwun Hwang
Could you send me the code of your applet?
Information and Download
barffour 3 12855 Last post April 10, 2015, 02:20:32 pm
by siamon
Juan M. Aguirregabiria (http://tp.lc.ehu.es/jma.html)
Ejs simulations from other web sites
lookang 0 10320 Last post September 09, 2011, 10:21:30 am
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.072 seconds with 23 queries.since 2011/06/15