[Development] QTcpSocket, QLocalSocket, common-use-model?

Joerg Bornemann joerg.bornemann at digia.com
Tue Oct 9 14:03:12 CEST 2012


On 08/10/2012 23:23, Charley Bay wrote:

 > QUESTION:  If you logically need a "network-socket" (LAN or WAN, but
 > sometimes accidentally on the same-computer), is there a *performance*
 > issue (or any reasonable design preference) where QLocalSocket would
 > be "preferable" to a QTcpSocket?  (...in the case where you detected
 > you were on the "same-computer" or a "Windows-network" so you could
 > use QLocalSocket, and you used QTcpSocket for other networks?)

Connections over unix domain sockets / named pipes do not go through the 
TCP stack. There's AFAIK no "short cut" for pure localhost TCP 
connections. Thus QLocalSocket should give you a certain performance 
advantage. But it depends on your application whether that potential 
performance boost is even noticable.

 > Does the "MyLocalSocketOrTcpSocket" class seem stupid, or should I
 > just use "QTcpSocket" all the time?

Measure, if that really makes a difference for you.


Cheers,

Jörg



More information about the Development mailing list