Project

General

Profile

Feature #273

A QtNetwork...erm.. WtNetwork Module would be nice

Added by Anonymous over 11 years ago. Updated over 11 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/19/2010
Due date:
% Done:

0%

Estimated time:

Description

As from the subject might be guessed: I'd love to see anlogue classes to the QtNetwork module in Wt, e.g. Q (W)TcpSocket, Q (W)UdpSocket, etc.

This would make it terribly easy to create web-guis for a couple of existing servers.

#1

Updated by Omer Katz over 11 years ago

Anonymous wrote:

As from the subject might be guessed: I'd love to see analogue classes to the QtNetwork module in Wt, e.g. Q (W)TcpSocket, Q (W)UdpSocket, etc.

This would make it terribly easy to create web-guis for a couple of existing servers.

Are you suggesting a wrapper of boost.asio?

Do you know how much work is that?

It would play nice with WSocketNotifier though

#2

Updated by Guido Seifert over 11 years ago

Are you suggesting a wrapper of boost.asio?

Yes.

Do you know how much work is that?

Erm....no, not really

It would play nice with WSocketNotifier though

The thing is, I know I can do with boost.asio all I need. And to tell you the truth, this made me a bit reluctant at first to write this feature request.

However, Wt almost feels like home for experienced Qt users, so I don't think this wish to go even further this is not too far-fetched.

#3

Updated by Wim Dumon over 11 years ago

It seems to me that (1) there are already nice and portable libraries that do networking, boost.asio is certainly one of them and (2) it is pretty straightforward to integrate them with Wt. I'm not sure if we would add a lot of value here.

I think you can implement such services either synchronously, or asynchronously. If you know that the network delay will be small, use the synchronous methods because it is easy to implement this in just about any signal handler. To this effect, I have both used curl and boost.asio (which has, despite its name, also a synchronous interface). When the answer of the synchronous request comes back, modify the widget tree and the updates will be propagated to the client.

The other possibility is to use asynchronous sockets and Wt's server push capabilities. Start the connection in the signal handler (possibly put some animation on the screen to entertain the user while his query is in progress). Use your favorite socket library for asynchronous socket IO (why not try boost.asio?). In every callback from the asynchronous library, whether it's to signal that you're connected, or to signal that some amount of data is received, you'll be able to grab the session's update lock, modify the widget tree, and call WApplication::triggerUpdate() to 'push' the updated widget tree to the client. When done, you may disable server push again for this session.

How would you consider the equivalent of QtNetwork to be a large improvement?

Also available in: Atom PDF