[1/8] from: patrick::philipot::laposte::net at: 6-May-2003 11:49
Hi, Is there a way to open an Internet connection from Rebol. Something like this if not connected? [ ; ; reconnect now ; ] Regards Patrick
[2/8] from: antonr:iinet:au at: 6-May-2003 23:08
No, and connected? is not a good indicator of whether you will get to your resource or not. Connected? just tells you whether there is a connection from your machine to another machine. That second machine may be connected to nothing else (or allows no connections to other machines because its web server is down, for example). For dialup users it may be an ok indicator, but for instance, DSL users who have a router in between their machine and the DSL modem, it is a very poor indicator of whether "the internet" is available. If you make the assumption that the user has dialup, your code will only work for dialup users. The best way to see if a network resource is available is to either see if it exists, or just try to download it. You will receive an error if there is a problem anywhere on the (possibly long) chain of machines between your machine and the one with the resource. It's easy to catch this error and take appropriate action. This turns out to be better code anyway. It would be nice to be able to cause a dialup connection to dialup, but then this is very OS specific code. You must delve into external libraries for this. Anton Rolls.
[3/8] from: greggirwin:mindspring at: 6-May-2003 9:46
Hi Pat, p> Is there a way to open an Internet connection from Rebol. As Anton said, it's OS specific and you need View/Pro to access the libraries to do it. It's not hard under Windows though. -- Gregg
[4/8] from: patrick:philipot:laposte at: 7-May-2003 9:48
Hi Anton, This was very informative. To sum up ... (1) I should try to access to something on the internet. For example, reading a file on my own site. (2) Connect using API or RASDIAL.EXE (I am using Windows 2000) . Basically, I need a timer to check my connection and reconnect if needed. Is it worth programming with Rebol ? Obviously it seems more suited for a small C program. Thanks anyway Patrick
[5/8] from: patrick:philipot:laposte at: 7-May-2003 10:01
Hi gregg, This OS specific thing is a bit controversial, isn't it ? Rebol claims itself "network smart". It is a bit odd IMHO not having an "Internet Connect" function. Therefore, Rebol users have to produce OS specific code ! which is not good for the Rebolution. Regards Patrick
[6/8] from: antonr:iinet:au at: 8-May-2003 2:22
Well, how much do you need to know about an operating system and a user's network setup to provide a seamless interface? That is, so that we can know for certain whether we are "connected" or "not connected" ? These are fuzzy edged things. There are a multitude of possible network setups. How do we determine when a network connection has been lost? If a remote machine that is serving us internet has crashed and is definitely down, we still have to wait 30 seconds for a timeout to occur before our software can be sure that there's a problem (for example). So, for 30 seconds we are unsure whether there is a network connection or not. How do we determine the "default" connection ? I have a dialup connection that I don't use anymore, and an ethernet connection to a gateway that has a connection to an adsl modem. How does the software know which one I would like to use ? Think about what code would have to be written to try to figure out which connection to favour (for every OS, and each windows 95/98/ME/NT/2k/XP is different). The reason it hasn't been done is because it is a large task. Some programs just try to use the default browser's default connection setting. But that is not a sure way to connect. I can imagine a set of dll libraries, one for each platform, that allow to reliably connect to the internet and check for a connection. Perhaps one day we will see this. Regards, Anton.
[7/8] from: antonr:iinet:au at: 8-May-2003 2:21
> Hi Anton, > > This was very informative. To sum up ... > > (1) I should try to access to something on the internet. > For example, reading a file on my own site.
If that's the file that you want, then yes. If the resources that you want are elsewhere, then no. :) Keep in mind that accessing a file does not prove that there is a connection available to another file. Also, having successfully accessed that file, it does not prove that you can access that file again in the future. Your site might be up, another site, down. The view desktop uses that method to report whether there is a connection or not, however. (It attempts to connect to rebol.com)
> (2) Connect using API or RASDIAL.EXE (I am using Windows 2000) . > > Basically, I need a timer to check my connection and reconnect if needed. > Is it worth programming with Rebol ? > Obviously it seems more suited for a small C program. > > Thanks anyway > Patrick
I think it would be educational to see if you can do it through a windows dll call. But if you are familiar with programming c on windows, then I think that would be easier. I have not tried to do this. But you can set your dialer to connect when an application attempts to access the internet in the dialup properties. Regards, Anton.
[8/8] from: greggirwin:mindspring at: 7-May-2003 10:36
Hi Patrick, ppln> This OS specific thing is a bit controversial, isn't it ? ppln> Rebol claims itself "network smart". ppln> It is a bit odd IMHO not having an "Internet Connect" function. ppln> Therefore, Rebol users have to produce OS specific code ! Well, they can't do *everything*. :) I would bet that it's not the simplest thing to account for because it's not consistent in every OS. That is to say, there is not always a definitive API or library to use, so there would have to be some kind of network setting, or maybe a whole lot of them if you consider how much info the RAS stuff takes under Windows. Couple that with the fact that not too many folks ask for it, and it probably hasn't seemed worth the effort to them. I know there are other things *I'd* rather have them doing, even though I need this ability myself for a project. -- Gregg