Networking Forums

Networking Forums > Computer Networking > Linux Networking > A socket in a web page?

Reply
Thread Tools Display Modes

A socket in a web page?

 
 
Martin
Guest
Posts: n/a

 
      02-06-2004, 12:54 PM
How can I get a TCP/IP socket connection IN A WEB PAGE that will
communicate with another computer where the client side is running
Linux and the server side is running Windows?

Here's my situation: I have an app (written in Visual Basic) that has
a web server built in to it. It runs on an intranet (no internet
access). One of the pages it serves out contains a Winsocket DLL and a
script that allows that page to connect back to a Winsocket at the
server. The server then sends information out to be displayed on the
web page. I have this all working successfully. But, obviously, it
works only with clients running Internet Explorer in Windows.

I would like to be able to get this to work with Linux/Unix based
clients as well but have no idea how to go about it. Is there an
equivalent to the "Winsocket" that will run in Linux? (Would this be a
BSD Socket?) Is it something that I can send out as part of a web page
from my Windows-based server? Can I use it from a script? If so, how?

Any guidance on this will be greatly appreciated.

Thanks.
 
Reply With Quote
 
 
 
 
Lew Pitcher
Guest
Posts: n/a

 
      02-06-2004, 04:15 PM
Martin wrote:

> How can I get a TCP/IP socket connection IN A WEB PAGE that will
> communicate with another computer where the client side is running
> Linux and the server side is running Windows?
>
> Here's my situation: I have an app (written in Visual Basic) that has
> a web server built in to it. It runs on an intranet (no internet
> access). One of the pages it serves out contains a Winsocket DLL and a
> script that allows that page to connect back to a Winsocket at the
> server. The server then sends information out to be displayed on the
> web page. I have this all working successfully. But, obviously, it
> works only with clients running Internet Explorer in Windows.


To paraphrase: you have a specially built MSWindows application that, under
certain circumstances, uses a socket to communicate with another app, and
then uses the results to build a webpage that is then presented to intranet
clients via a built in webserver.

Right?

> I would like to be able to get this to work with Linux/Unix based
> clients as well but have no idea how to go about it. Is there an
> equivalent to the "Winsocket" that will run in Linux? (Would this be a
> BSD Socket?) Is it something that I can send out as part of a web page
> from my Windows-based server? Can I use it from a script? If so, how?


Well, AFAICT, you have two options:

1) build a special Linux application that, under certain circumstances, uses
a socket to communicate with another app, and then uses the results to
build a webpage that is then presented to intranet clients via a built in
webserver, or
2) using existing Linux tools (i.e. "LAMP"), write a dynamic webpage that
uses features of it's scripting language to communicate with another
app, and then uses the results to build a webpage that is then presented
to intranet clients through the standard web server.

Both are doable, although neither is easier than the other.

Option 1 will require you to write a mini web server to handle the HTTP end
of things, but otherwise is easily accomplishable with the standard
/built-in/ sockets APIs (no add-on "WinSock" API needed).

Option 2 will require that you write the "socket interface" in whatever
scripting language you use for your dhtml. IIRC, PHP will do this, but you
may have to do some special processing to get it to work properly. If you
write in Java, you can use Java communications classes to do the work, and
Java is fully supported under Apache as a server side scripting and server
application language.

> Any guidance on this will be greatly appreciated.
>
> Thanks.



--
Lew Pitcher, IT Consultant, Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)

 
Reply With Quote
 
Bob Hauck
Guest
Posts: n/a

 
      02-06-2004, 04:55 PM
On Fri, 06 Feb 2004 06:54:17 -0700, Martin <(E-Mail Removed)> wrote:

> Here's my situation: I have an app (written in Visual Basic) that has
> a web server built in to it. It runs on an intranet (no internet
> access). One of the pages it serves out contains a Winsocket DLL and a
> script that allows that page to connect back to a Winsocket at the
> server.


I think this is what Sun has been touting Java for. You write a Java
applet that connects back to the server. This method will work on any
platform that supports the Java plugin. Even ones that are not powered
by an Intel CPU.


--
-| Bob Hauck
-| To Whom You Are Speaking
-| http://www.haucks.org/
 
Reply With Quote
 
Martin
Guest
Posts: n/a

 
      02-06-2004, 06:37 PM
On Fri, 06 Feb 2004 12:15:48 -0500, Lew Pitcher <(E-Mail Removed)>
wrote:

>To paraphrase: you have a specially built MSWindows application that, under
>certain circumstances, uses a socket to communicate with another app, and
>then uses the results to build a webpage that is then presented to intranet
>clients via a built in webserver.
>
>Right?


No, not quite.

I have a specially built MSWindows application that controls an
industrial process. The "user interface" is in the form of web pages
which are served out by the application itself (IIS is not used).

Several of the pages that are served out include a Winsocket that is
activated by a script when the page is loaded in the client's browser.
This client-side socket connects back to a server-side socket thus
providing a "pipe" thru which the server process can then send data
out to be displayed on the client's screen.

From the end-user's point of view, he's just sitting there looking at
his screen watching real-time updates of portions of his screen. No
additional pages are being sent or received.

It's my home-made version of "push" technology where the server is
pushing data out to the client.

The problem I'd like to overcome now is that this works only with
Internet Explorer / Windows clients; because only they can handle the
client-side Winsocket. I would like to be able to serve out a page
that would allow this same functionality on Linux/Unix clients.
 
Reply With Quote
 
Martin
Guest
Posts: n/a

 
      02-06-2004, 07:02 PM
On Fri, 6 Feb 2004 12:55:48 -0500, Bob Hauck
<(E-Mail Removed)> wrote:

>I think this is what Sun has been touting Java for. You write a Java
>applet that connects back to the server. This method will work on any
>platform that supports the Java plugin. Even ones that are not powered
>by an Intel CPU.


Do you know if this could be done with JavaScript as opposed to Java.
That is, could I just embed a script in the web page and somehow make
a socket connection back to my server?
 
Reply With Quote
 
Bob Hauck
Guest
Posts: n/a

 
      02-06-2004, 08:59 PM
On Fri, 06 Feb 2004 13:02:09 -0700, Martin <(E-Mail Removed)> wrote:
> On Fri, 6 Feb 2004 12:55:48 -0500, Bob Hauck
><(E-Mail Removed)> wrote:
>
>> I think this is what Sun has been touting Java for. You write a Java
>> applet that connects back to the server.


> Do you know if this could be done with JavaScript as opposed to Java.


I don't think so, but I know very little about JavaScript. I'm sure
someone who does will chime in 8-)


--
-| Bob Hauck
-| To Whom You Are Speaking
-| http://www.haucks.org/
 
Reply With Quote
 
ynotssor
Guest
Posts: n/a

 
      02-06-2004, 11:37 PM
"Martin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)

> I have a specially built MSWindows application that controls an
> industrial process. The "user interface" is in the form of web pages
> which are served out by the application itself (IIS is not used).
>
> Several of the pages that are served out include a Winsocket that is
> activated by a script when the page is loaded in the client's browser.
> This client-side socket connects back to a server-side socket thus
> providing a "pipe" thru which the server process can then send data
> out to be displayed on the client's screen.
>
> From the end-user's point of view, he's just sitting there looking at
> his screen watching real-time updates of portions of his screen. No
> additional pages are being sent or received.
>
> It's my home-made version of "push" technology where the server is
> pushing data out to the client.
>
> The problem I'd like to overcome now is that this works only with
> Internet Explorer / Windows clients; because only they can handle the
> client-side Winsocket. I would like to be able to serve out a page
> that would allow this same functionality on Linux/Unix clients.


Sounds like a job for a Java Applet.


--
use hotmail for any email replies


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
 
Reply With Quote
 
Fred Emmott
Guest
Posts: n/a

 
      02-06-2004, 11:56 PM
Martin wrote:

> On Fri, 06 Feb 2004 12:15:48 -0500, Lew Pitcher <(E-Mail Removed)>
> wrote:
>
>>To paraphrase: you have a specially built MSWindows application that,
>>under certain circumstances, uses a socket to communicate with another
>>app, and then uses the results to build a webpage that is then presented
>>to intranet clients via a built in webserver.
>>
>>Right?

>
> No, not quite.
>
> I have a specially built MSWindows application that controls an
> industrial process. The "user interface" is in the form of web pages
> which are served out by the application itself (IIS is not used).
>
> Several of the pages that are served out include a Winsocket that is
> activated by a script when the page is loaded in the client's browser.
> This client-side socket connects back to a server-side socket thus
> providing a "pipe" thru which the server process can then send data
> out to be displayed on the client's screen.
>
> From the end-user's point of view, he's just sitting there looking at
> his screen watching real-time updates of portions of his screen. No
> additional pages are being sent or received.
>
> It's my home-made version of "push" technology where the server is
> pushing data out to the client.
>
> The problem I'd like to overcome now is that this works only with
> Internet Explorer / Windows clients; because only they can handle the
> client-side Winsocket. I would like to be able to serve out a page
> that would allow this same functionality on Linux/Unix clients.


You could just use a http refresh header
 
Reply With Quote
 
Martin
Guest
Posts: n/a

 
      02-07-2004, 12:46 AM
On Sat, 07 Feb 2004 00:56:48 +0000, Fred Emmott
<(E-Mail Removed)> wrote:

>You could just use a http refresh header


Yeah - I did that at first. But that updates thaings only periodically
whereas the events that need to be displayed are occuring more or less
at random in "real time". With the socket link allowing me to push the
info out as it occurs, the display works much more realistically.

As others have suggested, I may have to go with a Java applet but that
seems like over-kill for my situation (plus I haven't a clue as to how
to develop a Java applet). This was so easy to accomplish in the
Windows environment, I would think that there would be an equally
simple solution available in the Linux/Unix world. But, maybe not...
 
Reply With Quote
 
ynotssor
Guest
Posts: n/a

 
      02-07-2004, 06:01 AM
"Martin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)

> As others have suggested, I may have to go with a Java applet but that
> seems like over-kill for my situation (plus I haven't a clue as to how
> to develop a Java applet). This was so easy to accomplish in the
> Windows environment, I would think that there would be an equally
> simple solution available in the Linux/Unix world. But, maybe not...


http://javaboutique.internet.com/javasource/ for some simple applets with
source code. One can study the structure of the code, or if you need some
introduction, use the "Tutorials" link at the left, then look for the "New
to Java" section. I think you'll be surprised at how easy it is, given your
current programming knowledge.

http://javaboutique.internet.com/tut.../add_java.html for a
turorial on how to add the applet to your web page.


tony

--
use hotmail for any email replies



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting index.jsp page as home page on IIS JOHN MATHEW Windows Networking 2 09-26-2007 07:43 AM
Test socket on Master Socket not working Kevin Cowans Broadband 14 11-15-2006 09:17 PM
10038 Socket Operation on non-socket error Tim G Windows Networking 1 09-26-2004 03:04 PM
WLAN Monitor 10038 Socket operation on non-socket Bill Windows Networking 1 03-01-2004 10:34 PM
Sending HTML page with a socket Farid Benzakour Linux Networking 1 12-11-2003 04:07 PM



1 2 3 4 5 6 7 8 9 10 11