forked from cculianu/SpikeGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSockUtil.h
More file actions
30 lines (24 loc) · 774 Bytes
/
SockUtil.h
File metadata and controls
30 lines (24 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* SockUtil.h
* SpikeGL
*
* Created by calin on 5/18/10.
* Copyright 2010 Calin Culianu <calin.culianu@gmail.com>. All rights reserved.
*
*/
#ifndef SOCK_UTIL_H
#define SOCK_UTIL_H
#include <QTcpSocket>
#include <QStringList>
namespace SockUtil
{
QString errorToString(QAbstractSocket::SocketError e);
void pushContext(const QString & n);
void popContext();
QString contextName();
bool send(QTcpSocket & sock, const QString & msg, int timeout_msecs,
QString * errStr_out = 0, bool debugPrintMsg = false);
QString readLine(QTcpSocket & sock, int timeout_msecs, QString * errStr_out = 0);
struct Context { Context(const QString &ctx) { pushContext(ctx); } ~Context() { popContext(); } };
}
#endif