how to tell when a dde response is complete? - dde

I'm talking to a DDE server I don't have very much documentation for using the NDde .NET library. I've attached handlers for both the Advise and Disconnected events and am receiving data successfully. I never see a Disconnected event raised nor do I see anything in the response stream that seems to signal that all the data has been returned. So, two questions: 1) where can I find a intro guide to DDE? There doesn't seem to be very much out there now regarding it. And 2) am I thinking about this correctly? Should the server tell me when it has sent all the data it intends to send for an Advise link in the data stream or by raising an event or do I have to estimate the number of responses that should be returned?
Thanks

I am the author of the NDde library so maybe I can help. It is a little late I know. Anyway, the client and server exchange information in an agreed upon protocol. So there is probably nothing you are doing wrong with the library. You just need to know how the server works. The Disconnected event will be raised when the conversation is terminated so that is probably not what you are looking for.

1) maybe here http://www.angelfire.com/biz/rhaminisys/ddeinfo.html you will find something useful (I understand MSDN it's not what you want)

Related

socket.io : Queries around broadcasting and max connections

I am new to Socket IO development. I wanted to know the following around it :
MAX limit for the number of concurrent OPEN Sockets supported ?
Guidelines / extra care to be taken to fine-tune the Node Server for Production.
Does socket.io ensure message deliver ? or it is send-and-forget ? Also are there any node-modules which when installed leverage this feature ?
In case socket.io does not support message delivery; how can I ensure that the message was sent and received successfully to the intended person ?
MAX limit for the number of concurrent OPEN Sockets supported ?
This depends entirely on your environment, your application, and its configuration. Socket.IO has many potential transports, some of which don't even require a persistent connection. There is no simple answer to this question, and nor should there be. This is the wrong question to ask. In a usual scenario, Socket.IO isn't going to be your bottleneck... your application itself will be. What you should be asking about is how to scale your application as you grow... and the answer to that is dependent on the specifics of how your application works.
Guidelines / extra care to be taken to fine-tune the Node Server for Production.
There are entire books on this. Start with the Node.js documentation.
Does socket.io ensure message deliver ?
Socket.IO when used in default configuration is a reliable transport. Of course things can always get lost... it's the internet after all... but yes, retries will happen. I've found this is one of the best parts of Socket.IO, is that if you need to ensure a message is going to get there, it does its best to do that.
Also are there any node-modules which when installed leverage this feature ?
What feature?
In case socket.io does not support message delivery; how can I ensure that the message was sent and received successfully to the intended person ?
Yes, you can deliver messages with Socket.IO... that's sort of the whole point. As far as whether data made it to the right person, you just need to send it to the right place. Remember though that someone else could always be sitting at the computer....

XMLHttpRequest detect new data from server before res.end()

Is it possible to detect new data from the server as it is sent? For example, with express.js:
res.write('Processing 14% or something');
and then display that on the page with a progress bar.
Edit:
My original question was a bit confusing so let me explain the situation. I have created a page where users can upload song files. These files are then converted (using ffmpeg) to .ogg and .mp3 files for the web. The conversion takes a long time. Is it possible to send real time data about the conversion back to the client using the same XMLHttpRequest that sent the files?
If i understand correctly you are trying to implement event based actions. Yes node.js has got some excellent web socket libraries such as socket.io and sack.js
You need to understand nodejs event driven pattern.
Websocket protocol helps maintain full duplex connection between server and client. You can notify clients when any action happens in server and similar you can notify server when any action happens in client. Libraries provide flexibility to broadcast event to all connected client or selected ones.
So it is basically emit and on that you will be using often.
Go through the documentation, it will not take much time to learn. Let me know if you need any help.

Web socket & Flash socket clients connect to one Node.js

I've got problem connecting Flash client to Node.js server.
Short story:
For a first time I'm building a Node.js server that should be used by both web client (WebSocket) as well as a Flash client (Socket). The web client, of course, works like a charm, but I can't get over the Flash one. I get SECURITY_ERROR. After a day of research I think it's because of the policy file not being loaded. Ideas (primus on top of engine.io) ?
Long story:
I'm using Primus as I thought I'll need it because I have both web sockets and flash sockets to handle. Not sure if this is accurate? :)
I'm using Engine.io as a 'transformer/transporter' - the main framework that the layer uses. I won't discuss the standard web client (using Chrome and primus-client), as it's easy to setup.
I'm using simple and standard Sockets in AS3:
_socket = new Socket();
_socket.addEventListener(Event.CONNECT, onSocketConnect);
//...
_socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
_socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_socket.connect('localhost', '1337);
When building it within Flash IDE, it goes to the onSocketConnect function, but if I try to write anything to the socked - I get disconnected. If I run this from the web browser, I get into the onSecurityError method.
I must say that I don't get any traces in the node console!
primus.on('connection', function connection(spark) {
console.log('new connection'); // never gets logged!
As I know, security error is thrown when there is error with the policy file, so I started searching for a solution for that.
I've read a lot of things online, and most common solution was simple usage of socket.io and so called FlashSocket.IO. I tried implementing it, but it's so old, that some of the code is a kind of missing and I finally got some errors from the hurlant library - I couldn't get it working.
I also saw some node package called policy, which runs separate server to server the policy file.
I tried adding a transport array with flashsocket in it - no change. I also can't understand why all of the samples are using transports - I've searched and both index.js and primus.js are using transport (why there are two separate files, Jesus?!)
I could try using only engine.io without primus, but I don't know if this would be of any help. All the posts and samples I've found are pretty old - please help me with any up to date solution or at least some explanation what needs to be done - seems like a whole new universe to me :)
Thanks in advance!
Edit:
Thanks to the The_asMan, I figured out it has something to do with the handshake. I've tried this simple example (despite the fact it's so old) - it worked perfectly for the Flash client! Of course I cannot connect web sockets to it, as the handshake is not proper - it has some kind of protocol for it.
So I guess I just have to understand how to get the <policy-file-request/> in node - I'll be able to return the policy file. But I don't know how to get it - I don't receive any kind of data nor connect handler...
You have a cross domain policy issue.
I answered it all here.
AS3 - Flash/AIR Socket Communication writeUTFBytes only works once
just an idea:
On some operating systems, flush() is called automatically between execution frames, but on other operating systems, such as Windows, the data is never sent unless you call flush() explicitly. To ensure your application behaves reliably across all operating systems, it is a good practice to call the flush() method after writing each message (or related group of data) to the socket.

Whats The Key Diffrence Between Request-Response and Push-Pull Service Model In Terms Of Network Or Website Application?

Recently I did Start To Learn Node.js abd As of That i did Figure out that nower day`s node.js is widely use cause it supports Push-Pull/Publish-subscript as well as Request-Response both kind of Programming Capability.
But After Reading 6 to 8 article still i have confusion on the diffrance between them.
Any Help Would Be Appriciated.
Thanks In Advance.
It is very simple.
Lets assume the server has an update for the client. For instance, the client receives a message.
In request-response, the client won't notice about that message until he will send a request to the server, using ajax or simply moving to another page (Executing Http request).
The main problem here is that the updates are not real-time/live. The client doesn't know if there are any updates for him until he make a further request.
On the other hand, in push-pull relation the sever pushes the updates to the client,
so the client informed about the message he receives live, without waiting for the next request to receive the update.
Pull technology vs Push technology technologies explained in wikipedia.

How to model Push Notifications on server

Brief Description:
Well, since many days I've been looking for an answer to this question but there seems to be answers for 'How to create a Push Notification Server' and like questions. I am using node.js and it's quite easy to 'create' a push notification server using sock.js (I've heard socket.io isn't good as compared to sock.js). No problem till here. But what I want is how to model such a server.
Details:
OK, so, let's say I've an application where there's a chat service (just an example this is, actual thing is big as you might have guessed). A person sends a message in a room and all the people in the room get notified. But what I want is a 'stateful' chat - that is, I want to store the messages in a data store. Here's where the trouble comes. Storing the message in the database and later telling everyone that "Hey, there's a message for you". This seems easy when we need the real-time activity for just one part of the app. What to do when the whole app is based on real-time communication? Besides this, I also want to have a RESTful api.
My solution (with which I am not really happy)
What I thought of doing was this: (on the server side of course)
Data Store
||
Data Layer (which talks to data store)
||
------------------
| |
Real-Time Server Restful server
And here, the Real-time server listens to interesting events that the data-layer publishes. Whenever something interesting happens, the server notifies the client. But which client? - This is the problem with my method
Hope you can be of help. :)
UPDATE:
I think I forgot to emphasize an important part of my question. How to implement a pub-sub system? (NOTE: I don't want the actual code, I'll manage that myself; just how to go about doing it is where I need some help). The problem is that I get quite boggled when writing the code - what to do how (my confusion is quite apparent from this question itself). Could please provide some references to read or some advice as to how to begin with this thing?
I am not sure if I understood you correctly; but I will summarize how I read it:
We have a real-time chat server that uses socket connections to publish new messages to all connected clients.
We have a database where we want to keep chat logs.
We have also a restful interface to access the realtime server to get current chats in a lazier manner.
And you want to architect your system this way:
In the above diagram, the components I circled with purple curve wants to be updated like all other clients. Am I right? I don't know what you meant with "Data Layer" but I thought it is a daemon that will be writing to database and also interfacing database for other components.
In this architecture, everything is okay in the direction you meant. I mean DataStore is connected by servers to access data, maybe to query client credentials for authentication, maybe to read user preferences etc.
For your other expectation from these components, I mean to allow these components to be updated like connected clients, why don't you allow them to be clients, too?
Your realtime server is a server for clients; but it is also a client for data layer, or database server, if we prefer a more common naming. So we already know that there is nothing that stops a server from being a client. Then, why can't our database system and restful system also be clients? Connect them to realtime server the same way you connect browsers and other clients. Let them enjoy being one of the people. :)
I hope I did not understand everything completely wrong and this makes sense for the question.

Resources