473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Socket in a web page - possible?

I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?

TIA
Jul 20 '05 #1
13 3353


Martin wrote:
I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?


Mozilla has XMLHttpRequest since Netscape 6/pre Mozilla 1.0 times, it
has a SOAP API since Mozilla 1.0 and it has a high-level web service API
since Mozilla 1.4, see
http://www.mozilla.org/projects/webservices/
All ways to send data to a HTTP server and receive data back with script
without any need to refresh an HTML window/frame document
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
On Wed, 11 Feb 2004 10:17:31 -0700, Martin <ma**********@comcast.net>
wrote:
I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?


No, but you can use a Java applet, as long as the server that it connects
to is the same machine that serves the applet (a security measure).

Ask in comp.lang.java for more information.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #3
Martin wrote:
I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?

TIA


I know you can do something like this in Java. (Not JavaScript...
different technology). I have done something where the Java applet
connects to a port (not 80) on the server that the page came from. I am
pretty sure you can get Java to talk to the DOM... though I have never
tried. Java is more platform independant, but still not guaranteed on
all browsers.

Brian

Jul 20 '05 #4
> I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?


Yes. I have used <iframe> in IE and Mozilla to do this very thing.
Jul 20 '05 #5
In article <48********************************@4ax.com>,
Martin <ma**********@comcast.net> wrote:
I would like to serve out a web page (intranet only - no internet)
that has the ability to open a client-side socket that connects to a
server-side socket on another computer. This connection is used to
send data to be displayed using DHTML on the web page (as opposed to
refreshing the entire page).

I have this working where the client is running Internet Explorer in
Windows (the client-side socket is an ActiveX DLL). I would like to
get this to work from a Mozilla browser running in Linux. The ActiveX
stuff, of course, will not work there.

Is there something I can use in a Javascript that will work in Linux?

TIA


This page describes a portable method (IE and Mozilla) that works for me:

http://jibbering.com/2002/4/httprequest.html

Jim

--
--------------------------------------------------------------------------------
Jim Buzbee "I was gratified to be able to
jb*****@nyx.net answer promptly, and I did. I
http://batbox.org said I didn't know." Mark Twain
Jul 20 '05 #6
I greatly appreciate the responses to my question - thanks.

I tried using a Java Applet but it seems to be a major overkill for
what I'm trying to do. With an applet, my entire concept changes from
being a web page to being an applet screen. The Java plugin has to be
installed on each client machine (that was a big hassle on my test
Linux machine); and I'd have to learn how to use the Java SDK; etc.,
etc.

I looked at the "iframe" that was suggested. I found a web site that
had a working example of that and verified that it does work on both
the IE/Windows and on the Mozilla/Linux clients. Like the applet
concept, it appears that it would do the job but it's still more than
what I actually need.

I think the same thing is true of the HTTPRequest approach. That is,
it will do what I want to do but it's too much for what I need to do.

Can anyone tell me if it's possible (practical / realistic) to simply
open a socket as the client side of a connection (on a Linux machine)
thru which a small amount of data can be sent to the web page? This is
the approach I'm using now with the Windows machines; I'd just like to
get this to work on Linux boxes.

I downloaded a Javascript from
http://www.phpfreaks.com/phpmanual/p...f.sockets.html but have not
been able to get it to work yet. I don't know if it's even "workable".

Any thoughts?
Jul 20 '05 #7
On Wed, 11 Feb 2004 17:00:18 -0700, Martin <ma**********@comcast.net>
wrote:
I downloaded a Javascript from
http://www.phpfreaks.com/phpmanual/p...f.sockets.html but have not
been able to get it to work yet. I don't know if it's even "workable".


That's PHP, not JavaScript, and it's server-side, not client-side.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #8
On Thu, 12 Feb 2004 00:04:11 GMT, Michael Winter
<M.******@blueyonder.co.invalid> wrote:
On Wed, 11 Feb 2004 17:00:18 -0700, Martin <ma**********@comcast.net>
wrote:
I downloaded a Javascript from
http://www.phpfreaks.com/phpmanual/p...f.sockets.html but have not
been able to get it to work yet. I don't know if it's even "workable".


That's PHP, not JavaScript, and it's server-side, not client-side.

Mike


Example 2 says its client-side.

As to PHP vs Javascript, I'm clueless. Can this be done with
Javascript?

Jul 20 '05 #9
On Wed, 11 Feb 2004 18:26:33 -0700, Martin <ma**********@comcast.net>
wrote:
On Thu, 12 Feb 2004 00:04:11 GMT, Michael Winter
<M.******@blueyonder.co.invalid> wrote:
On Wed, 11 Feb 2004 17:00:18 -0700, Martin <ma**********@comcast.net>
wrote:
I downloaded a Javascript from
http://www.phpfreaks.com/phpmanual/p...f.sockets.html but have not
been able to get it to work yet. I don't know if it's even "workable".
That's PHP, not JavaScript, and it's server-side, not client-side.


Example 2 says its client-side.


It says it's a TCP/IP client. That is not the same as client-side. Even
so, it is still written in PHP which can only be interpreted server-side.
As to PHP vs Javascript, I'm clueless. Can this be done with
Javascript?


No. You'll have to use one of the other suggestions in this thread.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #10
Martin wrote:
I looked at the "iframe" that was suggested. I found a web site that
had a working example of that and verified that it does work on both
the IE/Windows and on the Mozilla/Linux clients. Like the applet
concept, it appears that it would do the job but it's still more than
what I actually need.
Hmmmm.... If IFRAME will work for you, I hardly consider it to be
overkill. It is more portable than what you are currently doing with a
client-side socket, using a Win32 DLL.

Note that you had to use a platform specific mechanism, for sockets,
because the browser did not support sockets natively. This means that
every other browser (Netscape/Mozilla/Opera/Safari/Konquerer/etc) will
all have to have their own platform specific mechanism... yuck.

IFRAMEs are part of the HTML standard, so if you can get it working with
IFRAMEs, I would highly suggest doing so. It is less overkill than an
ActiveX DLL.
I downloaded a Javascript from
http://www.phpfreaks.com/phpmanual/p...f.sockets.html but have not
been able to get it to work yet. I don't know if it's even "workable".


Just a note... PHP is a scripting language, just like Javascript is.
The difference is that PHP is a server-side scripting environment
(similar to ASP or CGI). Basically, you write a script, that the server
executes BEFORE it sends it to the browser. (The server needs to know
how to read PHP) The output of the script must be HTML/Javascript or an
image, or something that a browser can recognize.

By using sockets in PHP, on the server, you can have your PHP script
connect to something, like a database, or some service on another
server, to get data that it formats into HTML, and dynamically sends to
the client. In that sense, it is a client to the service it is getting
it's data from, but as far as the web browser is concirned, it is still
on the server... so PHP cannot be used to create sockets on the web
browser side of things.

I hope this helps a bit. If you can get your application working with
the IFRAME object, I recommend that is what you use.

Brian

Jul 20 '05 #11
>I hope this helps a bit. If you can get your application working with
the IFRAME object, I recommend that is what you use.

Brian


Brian / Michael:

Thanks for the further explanations.

I didn't realize that PHP was so far off from what I needed. I won't
bother persuing that any further.

It does look like the iFrame approach might be my best option.

One thing I don't understand about it yet is: can I "push" data out
from the server to the iFrame target? In my situation, there are
events occurring on the server that create data that I want to display
on the browser's current screen. I don't want the user to have to do
anything to get that data. All I'm doing on the client side (in the
version I have working) is updating the contents and colors of several
cells in a table that is already displayed.

In the example that I played with (that I mentioned previously), I had
to click a button to request some data to be sent from their server.
Is something like that REQUIRED or is that just the way this
particular example was set up?

Thanks again for any additional comments.

Martin
Jul 20 '05 #12
Martin wrote:
I hope this helps a bit. If you can get your application working with
the IFRAME object, I recommend that is what you use.

Brian

Brian / Michael:

Thanks for the further explanations.

I didn't realize that PHP was so far off from what I needed. I won't
bother persuing that any further.

It does look like the iFrame approach might be my best option.

One thing I don't understand about it yet is: can I "push" data out
from the server to the iFrame target? In my situation, there are
events occurring on the server that create data that I want to display
on the browser's current screen. I don't want the user to have to do
anything to get that data. All I'm doing on the client side (in the
version I have working) is updating the contents and colors of several
cells in a table that is already displayed.

In the example that I played with (that I mentioned previously), I had
to click a button to request some data to be sent from their server.
Is something like that REQUIRED or is that just the way this
particular example was set up?

Thanks again for any additional comments.

Martin

Using the IFRAME approach, it is like having a separate page embedded
inside the actual page. The IFRAM can be hidden, so it only exists as
an interface for you, and the user never sees it.

Here is what you do:

On the main page, get your request ready, but do not actually make it
from the main page. Instead, tell the IFRAME to make the request.
Since the user never see's the IFRAME, he will never see the waiting.
Now, the IFRAME can take a long time to respond. When it finally does,
stating that the request is done, your main page can know this, and
alert the user.

You can also tell the IFRAME to check for new data, which will return
quickly. Parse the data out of the IFRAME DOM, and do what you need in
the main frame.

It is not a pushing method, but it is close enough to get what you need.

Brian
Jul 20 '05 #13
Here is a concise discription of iFrame. While on the Apple site, it
does cover the Windows implementation.

http://developer.apple.com/internet/...pt/iframe.html
I haven't used iFrame but could you use an event timer in you javascript
to refresh you html code via dhtml?

Robert
Jul 20 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bart Plessers \(artabel\) | last post by:
Hello, I am wondering if one could do following. I have a main frame with 3 subframes ("top", "left" and "contents") I have a link in the left frame, someting like: <a...
3
by: Peter | last post by:
Hello! Please, could anyone say, can one combine javascript and vbscript in same asp page? I am in situation where I must run some code in javascript and some of it in vbscript. Can I change...
2
by: dream machine | last post by:
Hi all, I'm try to check if the one client socket is really connected at my SocketServer . I build Client Socket with BeginAccept() , and I want to receive data with BegenReceive() call ! The...
0
by: Ed Eichman | last post by:
Hi Everyone, Is it possible to generate, in code, exactly (or close to it) the detailed error page generated by (IIS? ASP.NET? .NET Framework?) when an exception is thrown in a ASP.NET web...
2
by: Mark | last post by:
Hi, I am wanting to know if it is possible to embed a UserControl into a Page at runtime. What I am trying to do is allow a user to specify that they want a "contact form" or a "latest news" in...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: highab | last post by:
Hello, I want to send a parameter (string) to an external js file. I found something very similar to what I wanted with you but it doesn't answer my question, so here goes: I call my...
8
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi all, I am new to .net technologies. ASP.NET supports socket programming like send/receive in c or c++? I am developing web-site application in asp.net and code behind is Visual C#. In...
3
by: mishrarajesh44 | last post by:
hiiii, i am making addressbook, which will include name,mobile,address, photo, and want to save in mysql databqse all data and only the name of image file. i want that by clicking the submit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.