KProtocolManager fit for use?
Andreas Hartmetz
ahartmetz at gmail.com
Tue Nov 27 21:22:03 GMT 2007
Am Dienstag 27 November 2007 21:00:22 schrieb Thiago Macieira:
> Em Tuesday 27 November 2007 20:27:49 Andreas Hartmetz escreveu:
> > Am Dienstag 27 November 2007 19:53:57 schrieb Thiago Macieira:
> > > Em Monday 26 November 2007 20:18:16 Andreas Hartmetz escreveu:
> > > > As I'm writing a class called KTcpSocket to resurrect and clean up
> > > > SSL support, I had the not-so-crazy idea to make it optionally (but
> > > > by default) obey proxy setting from KProtocolManager:
> > >
> > > When I prototyped the KTcpSocket class for you, I had there:
> > >
> > > void connectToHost(const QUrl &url, OpenMode mode = ReadWrite);
> > > void connectToHost(const QString &protocol, const QString &host,
> > > quint16 port,
> > > OpenMode mode = ReadWrite);
> >
> > We can really lose the OpenMode, right? I can't think of any useful
> > network service whose use does not involve reading *and* writing. AFAICS
> > open modes are there because, for files, you can easily make sure that
> > you don't unintentionally overwrite something. Sockets are temporary and
> > have only one program accessing it - protection is pointless.
>
> I don't think so. There are other flags in there, including the Text
> transformation (CRLF <-> LF mapping done by QIODevice).
>
QIODevice::Text
When reading, the end-of-line terminators are translated to '\n'. When
writing, the end-of-line terminators are translated to the local encoding,
for example '\r\n' for Win32.
That doesn't make sense for a network protocols which of course uses only one
end-of-line convention regardless of host OS.
QIODevice::Unbuffered
Any buffer in the device is bypassed.
But: "....In other cases, the restriction may be due to the implementation, or
may be imposed by the underlying platform; for example, QTcpSocket does not
support Unbuffered mode..."
The other flags are read/write protection or only relevant to files anyway --
Truncate and Append.
I haven't had a good look at all of them before but now I have, and none of
them applies to a socket.
More information about the kde-core-devel
mailing list