473,541 Members | 15,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket programming with JS!

Hello,

Is it possible to live-capture data with JS? The XMLHttpRequest() method is
not really suitable for live data capture.

Any hints/directions?

TIA

Boomer
Sep 9 '06 #1
6 8959
"Boomer" <bo******@hotmail.comwrote in message
news:U0*******************@bignews3.bellsouth.net. ..
Hello,

Is it possible to live-capture data with JS? The XMLHttpRequest() method
is not really suitable for live data capture.

Any hints/directions?

TIA

Boomer
In what context ? js has no "native" file/stream functionality, so maybe
there are existing objects which you could script to achieve your aim...

Tim

Sep 9 '06 #2

Tim Williams wrote:
"Boomer" <bo******@hotmail.comwrote in message
news:U0*******************@bignews3.bellsouth.net. ..
Hello,

Is it possible to live-capture data with JS? The XMLHttpRequest() method
is not really suitable for live data capture.
To be honest, HTTP itself isn't really suitable for live data capture.
The whole request, response thing, you know.....

Any reason you couldn't use XmlHttpRequest with a timer?

Any hints/directions?

TIA

Boomer

In what context ? js has no "native" file/stream functionality, so maybe
there are existing objects which you could script to achieve your aim...

Tim
Sep 9 '06 #3
"Any reason you couldn't use XmlHttpRequest with a timer?"

The data is somewhat unpredictable and in many case repetitious. There is no
way of knowing the data that is being captured is old or new when using
XMLHttpRequest().

Thanks for all your comments.

Boomer


Sep 10 '06 #4
VK
Boomer wrote:
The data is somewhat unpredictable and in many case repetitious. There is no
way of knowing the data that is being captured is old or new when using
XMLHttpRequest().
XMLHttpRequest is simply a "virtual browser" (with very harrow
functionality) programmatically created inside the real one. This way
old data/new data question must be solved by the regular Web browsing
means: by setting and checking cache-related headers. It can be also
HEAD request made before GET/POST to see if you need to make new data
request.
If you are thinking of a socket listener, so you would get automated
server notification on new data ready - then HTTP doesn't deal with
such things. Respectively a web-browser has nothing to offer on this
matter.

Sep 10 '06 #5
Boomer wrote:
Is it possible to live-capture data with JS? The XMLHttpRequest() method is
not really suitable for live data capture.
Though its name suggests the opposite, XMLHttpRequest() can be used to
fetch non-XML data as well. And the connection doesn't need to point
to the 'default' http daemon as well; e.g. http://12.34.56.789:585
should take you to port 585 instead of (common) 80.

But the service must accept HTTP-style socket communication anyhow if
you want to connect from a javascript client.

--
Bart

Sep 10 '06 #6
Boomer wrote:
The data is somewhat unpredictable and in many case repetitious. There is no
way of knowing the data that is being captured is old or new when using
XMLHttpRequest().
One solution to this is to have a sequence number that is incremented
on each request. The server keeps track of changes in status, and
remembers the current sequence number t, and sends that sequence number
with each request. When the client issues a request it sends the last
sequence number it received u, the server sends any changes in the data
between u and t.

It requires a somewhat complex state machine running on the server, but
the client side is easy enough.

Typically you would put a limit on the age of sequence numbers, if the
client sends one that is too old the server sends a 'keyframe' that
includes all data, allowing the client to reset everything to the
current status.

The system is still poll driven rather than interrupt driven, but
signifcantly reduces the traffic volume. (And it sounds like that is a
goal in your case).

HTH

Sam

Sep 11 '06 #7

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

Similar topics

1
6323
by: pyguy2 | last post by:
Issues of socket programming can be wierd, so I'm looking for some comments. In my python books I find exclusive use of socket.close(). From my other readings, I know about a "partial close operation". So, I figured it would be useful to post some code about how socket.close() has an implicit send in it and you can actually gain some...
5
3669
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose but have been unsuccessful in finding the answers so far. Either because my understanding of sockets isn't where it needs to be or my questions are...
1
3379
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows XP. About the architecture: I have a socket server dll that contains a class that handles connections for a given local ipaddress and port. This...
5
11655
by: mscirri | last post by:
The code below is what I am using to asynchronously get data from a PocketPC device. The data comes in fine in blocks of 1024 bytes but even when I send no data from the PocketPC constant blocks of 1024 with all values set to Null arrive. Other than examine a block of 1024 to see if the entire block is null, is there any other way to determine...
2
15306
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I now see the socket.RecieveTimeout 'property' in the visual studio 2005 help documentation (framework 2.0) and it has example of it being used with...
10
4005
by: Uma - Chellasoft | last post by:
Hai, I am new to VB.Net programming, directly doing socket programming. In C, I will be able to map the message arrived in a socket directly to a structure. Is this possible in VB.Net. Can anyone please help me with some sample codings and guidance? Can you also suggest some other news group available for socket programming in VB.Net?
11
8582
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling mechanisms. I use a non-blocking approach for this, using the call to 'poll' to support the async mechanism - rather than the 'begin' and 'end'...
0
1890
by: shonen | last post by:
I'm currently attempting to connect to a shoutcast server pull down the information from here and then I'll parse it. I got this working with the httplib, which was great, the problem is I want to use the select statement to do only do this periodically. (I'm trying to be a client, accepting data, that might be my first problem) Basically...
8
4666
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 page_load event, I am using atl com component. Here one for loop is there. In this for loop, number of iterations are 1000, I can receive some data...
3
2757
by: Stuart | last post by:
I am in the process of teaching myself socket programming. I am "playing around" with some simple echo server-client programs for m the book TCP/IP Sockets in C. The Server program is: #include "TCPEchoServer.h" /* TCP echo server includes */ #include <pthread.h /* for POSIX threads */
0
7372
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7711
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7306
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7657
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
605
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.