I am trying to get the serial data and display it on the GUI, that i made in the QT for that when I try to get the serial data and display it in the output, it shows me this garbage type value.
"?\u0004?#\u0004??\u0004?#\u001C??"
"?\u0004?#\u0004??\u0004?#\u001C???\u0004?#\u001C"
this whole code is below, but the culprit lines are "readserial" function in the last.
#include "dialog.h"
#include "ui_dialog.h"
#include <QSerialPort>
#include<string>
#include<QDebug>
#include<QMessageBox>
#include <QSerialPortInfo>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
ui->label->setText("0");
arduino = new QSerialPort(this);
serialBuffer = "";
bool arduino_is_availabe = false;
QString arduino_uno_port_name;
foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts())
{
if(serialPortInfo.hasProductIdentifier() && serialPortInfo.hasVendorIdentifier())
{
if((serialPortInfo.productIdentifier() == arduino_uno_product_id) && (serialPortInfo.vendorIdentifier() == arduino_uno_vendor_id))
{
arduino_is_availabe = true;
arduino_uno_port_name = serialPortInfo.portName();
}
}
}
if(arduino_is_availabe)
{
qDebug() <<"Found the arduino port...\n";
arduino->setPortName(arduino_uno_port_name);
arduino->open(QSerialPort::ReadOnly);
arduino->setBaudRate(QSerialPort::Baud9600);
arduino->setBaudRate(QSerialPort::Data8);
arduino->setFlowControl(QSerialPort::NoFlowControl);
arduino->setParity(QSerialPort::NoParity);
arduino->setStopBits(QSerialPort::OneStop);
QObject::connect(arduino, SIGNAL(readyRead()), this, SLOT(readSerial()));
}else
{
qDebug() <<"Couldn't find the correct port for the arduino.\n";
QMessageBox::information(this, "serial port error", "couldn't open the serial port to arduino ");
}
}
Dialog::~Dialog()
{
if(arduino->isOpen())
{
arduino->close(); // Close the serial port if it's open.
}
delete ui;
}
void Dialog::readSerial()
{
QByteArray serialData;
serialData=arduino->readAll();
serialBuffer+=QString::fromStdString(serialData.toStdString());
qDebug()<<serialBuffer;
}
void Dialog::on_label_linkActivated(const QString &link)
{
ui->label->setText(serialBuffer);
}
I think your problem is right here:
arduino->setBaudRate(QSerialPort::Baud9600);
arduino->setBaudRate(QSerialPort::Data8);
You are setting the baud rate twice in a row, which makes no sense. In the second line you are setting a value of QSerialPort::Data8, so perhaps you are trying to define the setDataBits method. It would look like this:
arduino->setBaudRate(QSerialPort::Baud9600);
arduino->setDataBits(QSerialPort::Data8);
Related
I successfully read from a serial port with QSerialPort when I setup the instance's parameters in my main window constructor. I want my GUI to enable changing port however, but I can't seem to start reading when changing my com port after starting my application (I do so with a spinBox that sets up the COM port name of my QSerialPort instance). Here is my code (mainwindow.cpp), my problem is that if I do not directly use serial->setPortName(); in my constructor, and I put it in my slot linked to my spinBox signal, I can't read data received from my com port with qDebug anymore.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
QSerialPort *serial;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this); // Here by default. Takes a pointer to mainwindow as argument
serial = new QSerialPort(this);
qDebug() << "nb ports: " << QSerialPortInfo::availablePorts().length();
foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts())
{
qDebug() << "name" << serialPortInfo.portName();
}
qDebug() << "is " << serial->open(QSerialPort::ReadOnly);
qDebug() << "err " << serial->error();
// Create the signal and slot for
connect(ui->com_spinBox, SIGNAL(valueChanged(const QString&)),
this, SLOT(setComPort(const QString&)));
// Create the signal and slot for receiving data from device
connect(serial, SIGNAL(readyRead()), this, SLOT(serialReceived()));
}
MainWindow::~MainWindow()
{
delete ui;
serial->close(); // instance is closed when mainwindow destroyed
}
// My 2 custom slots below!!!
void MainWindow::serialReceived()
{
QByteArray ba;
ba = serial->readAll();
ui->label->setText(serial->readAll());
qDebug()<<ba;
}
void MainWindow::setComPort(const QString& com)
{
serial->close();
serial = new QSerialPort(this); // this (mainwindow) is parent
qDebug() << serial->portName();
QString comPort = "COM" + com;
qDebug() << comPort;
serial->setPortName(comPort);
serial->setBaudRate(QSerialPort::Baud9600);
serial->setDataBits(QSerialPort::Data8);
serial->setParity(QSerialPort::NoParity);
serial->setStopBits(QSerialPort::OneStop);
serial->setFlowControl(QSerialPort::NoFlowControl);
serial->open(QSerialPort::ReadOnly);
}
Here I tried moving all my serial instance setup from constructor to my slot, and close and re-open the instance to see if it helps, but I still cannot read anything with serialReceived() slot when tuning to the right COM port.. It does work if I put everything in the constructor and setPortName() with the right port number at the start of the program.
Thanks!
Try to delete and create again your QSerialPort before setPortName()
serial->deletLater();
serial = new QSerialPort(this);
serial->setPortName("COM1");
I'm trying to create a simple app which allows user to enter a word and the app will output the definition. I have compiled words and definitions by making mysql database file. I thought using MySQL would be a faster way make my app. My database looks like this:
rowed | Column1(word) | Column2(definition)
1 DNA A double-stranded,helical...
The pseudocode for this program definitely should be like this:
if(lineEdit == wordInput)
{
ui->label->setText("Display definition)
}
I just can't figure out how to do it. So far I have tried following code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QDebug>
#include <QPalette>
#define Path_to_DB "/Users/makkhay/Desktop/nep_eng-2.sqlite"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Set background picture
QPixmap bkgnd("/Users/makkhay/Desktop/background.jpg");
bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);
myDB = QSqlDatabase::addDatabase("QSQLITE");
myDB.setDatabaseName(Path_to_DB);
QFileInfo checkFile(Path_to_DB);
if(checkFile.isFile())
{
if(myDB.open())
{
ui->label->setText("The database is connected");
}
}else{
ui->label->setText("No file found!");
}
}
MainWindow::~MainWindow()
{
delete ui;
myDB.close();
}
void MainWindow::on_pushButton_clicked()
{
// QMessageBox::StandardButton reply= QMessageBox::question(this,
// "My Title", " Word not found, quit app?",
// QMessageBox::Yes | QMessageBox::No);
// if(reply == QMessageBox::Yes){
// QApplication::quit();
//}
if(!myDB.isOpen()){
qDebug() << " No connection to db";
return;
}
QString wordInput, definition;
wordInput = ui->lineEdit->text();
QSqlQuery qry;
qry.prepare("SELECT Column1,Column2 FROM Nepali WHERE Column1 = :input");
qry.bindValue(":input",wordInput);
// int fieldNo = query.record().indexof("Column1");
if(qry.exec())
{
ui->debug->setText(" Checking output!"); // output is visible
while (qry.next())
{
ui->output->setText("Checing output!"); // output is not visible
QString inputWord = qry.value(0).toString();
QString wordDefinition = qry.value(1).toString();
ui->output->setText(wordDefinition);
}
}
}
OK, the following code works for me. Try commenting out your existing code and pasting this code in. This code is basically the exact same code you posted, I just commented out some of the code to set the background and removed some excess lines.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QDebug>
#include <QPalette>
#include <QSqlQuery>
#include <QFileInfo>
#define Path_to_DB "/Users/makkhay/Desktop/nep_eng-2.sqlite"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Set background picture
//QPixmap bkgnd("/Users/makkhay/Desktop/background.jpg");
//bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
//QPalette palette;
//palette.setBrush(QPalette::Background, bkgnd);
//this->setPalette(palette);
myDB = QSqlDatabase::addDatabase("QSQLITE");
myDB.setDatabaseName(Path_to_DB);
QFileInfo checkFile(Path_to_DB);
if(checkFile.isFile())
{
if(myDB.open())
{
ui->label->setText("The database is connected");
}
}else{
ui->label->setText("No file found!");
}
}
MainWindow::~MainWindow()
{
delete ui;
myDB.close();
}
void MainWindow::on_pushButton_clicked()
{
if(!myDB.isOpen()){
qDebug() << " No connection to db";
return;
}
QString wordInput;
wordInput = ui->lineEdit->text();
QSqlQuery qry;
qry.prepare("SELECT Column1,Column2 FROM Nepali WHERE Column1 = :input");
qry.bindValue(":input",wordInput);
if(qry.exec())
{
ui->debug->setText(" Checking output!");
while (qry.next())
{
// Retrieve Values from select statement
QString inputWord = qry.value(0).toString();
QString wordDefinition = qry.value(1).toString();
// Display values
ui->output->setText(wordDefinition);
}
} else {
qDebug() << "query failed to execute";
}
}
After declaring the qry variable the code should look like this:
qry.prepare("SELECT Column1,Column2 FROM tableName WHERE Column1 = :input");
qry.bindValue(":input",wordInput);
if(qry.exec())
{
if (qry.next())
{
// Extract the results from the SELECT statement
QString inputWord = qry.value(0).toString();
QString wordDefinition = qry.value(1).toString();
// Then use the values for whatever you wish.
}
}
You don't need comma before WHERE. Also, I guess that you are comparing Column1 with wordInput, not Column2.
if(qry.exec("SELECT Column1,Column2 FROM some_table WHERE Column1='"+ wordInput+"'"))
Edit: you don't mention a table you are selecting from.
I am new in Qt and I need to do a program who export html page to PDF
So, the main idea is use QWebPage for interpret html and export itself to pdf with QPrinter.
I have two class webview who use QWebPage and Print who use QPrinter.
In main.cpp I have connect LoadFinished to PrintPDF slot:
Print *pdf = new Print(args);
webview *nav = new webview();
nav->setPrinter(pdf->getPrinter());
if(nav->load(args) == false) {
qDebug() << "can't load page";
return 0;
}
//when the page page is ready, we will print it
QObject::connect(nav->getFrame(), SIGNAL(loadFinished(bool)), nav, SLOT(printPDF(bool)));
My webview.cpp class:
#include "webview.h"
webview::webview()
{
page = new QWebPage;
printer = 0;
}
webview::~webview()
{
delete page;
}
bool webview::load(Arguments *args)
{
QRegularExpression url("^(file|http)://");
QRegularExpression fullPath("^/");
QRegularExpressionMatch pathMatch = fullPath.match(args->getSource());
QRegularExpressionMatch urlMatch = url.match(args->getSource());
// see http://qt-project.org/doc/qt-4.8/qwebsettings.html#WebAttribute-enum for more informations
page->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
page->settings()->setAttribute(QWebSettings::AutoLoadImages, true);
page->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
page->settings()->setAttribute(QWebSettings::PrintElementBackgrounds, true);
page->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
if(pathMatch.hasMatch()) {
page->mainFrame()->load(QUrl::fromLocalFile(args->getSource()));
} else {
if (urlMatch.hasMatch()) {
page->mainFrame()->load(QUrl(args->getSource()));
} else {
fprintf(stderr, "%s\n", qPrintable(QApplication::translate("main", "Error: Invalide source file")));
return false;
}
}
return true;
}
void webview::printPDF(bool ok)
{
if(ok == true) {
qDebug() << "okay";
} else
qDebug() << "non okay";
if(printer != 0)
page->mainFrame()->print(printer);
}
This is what my console display:
non okay
QPainter::begin: A paint device can only be painted by one painter at a time.
I have no idea where the error might be due. The whole project is here
The arguments are:
./htmltopdf http://stackoverflow.com destinationFolder
(destinationFolder is not yet implemented, you must directly modify the source code)
You have more than one Painter in your Code. Search for it.
I thing the Problem is in your "Printer Class". With a Local Printer in the printPDF Method it works. Try it:
void webview::printPDF(bool ok)
{
QPrinter printer(QPrinter::HighResolution);
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
QString(), "*.pdf");
printer.setPageSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
page()->mainFrame()->print(&printer);
}
UPDATE: Here a small working Example:
testview.cpp
#include "testview.h"
#include <QWebFrame>
#include "webview.h"
#include <QWebPage>
#include <QGridLayout>
testview::testview(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
QGridLayout* Layout = new QGridLayout(this);
webview* w = new webview(this);
w->setMinimumSize(500, 500);
centralWidget()->setLayout(Layout);
bool a = connect(w->page()->mainFrame(), SIGNAL(loadFinished(bool)), w, SLOT(printPDF(bool)));
w->page()->mainFrame()->load(QUrl("http://stackoverflow.com"));
}
testview::~testview()
{
}
webview.cpp
#include "webview.h"
#include <QPrinter>
#include <QWebFrame>
#include <QFileDialog>
webview::webview(QWidget *parent)
: QWebView(parent)
{
}
webview::~webview()
{
}
void webview::printPDF(bool ok)
{
QPrinter printer(QPrinter::HighResolution);
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
QString(), "*.pdf");
printer.setPageSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
page()->mainFrame()->print(&printer);
}
The problem was elsewhere :
In my main.cpp I had this :
QObject::connect(nav->getFrame(), SIGNAL(loadFinished(bool)), nav, SLOT(printPDF(bool)));
[...]
delete args;
delete pdf;
delete nav;
return app.exec();
app.exec() is a kind of infinit loop who thaht handles Qt events and thus allows the program does not close.
If I proceed to delete before calling this function,then I will have freshly deallocated pointers that will be used
If I Do :
bool result = app.exec();
delete args;
delete pdf;
delete nav;
return result;
It's work fine !
I am developing a GUI using Qt for a test UDP server application i wrote in C using the sockets interface available in unix. I aim of the GUI is to display all the messages (perror and fprintf) in either a "text edit box" or "text browser box". Here is my code,
//-----------------------------Main.Cpp------------------------------------------//
//-----------------------------QT specific headers-------------------------------//
#include "mainwindow.h"
#include <QApplication>
#include <QLabel>
//------------------------------------------------------------------------------------//
int main(int argc, char *argv[])
{
int sock_fd=0;
funct_class funct_class_obj;
QApplication a(argc, argv);
MainWindow w;
sock_fd=funct_class_obj.udp_config();
funct_class_obj.recv_fucnt(sock_fd);
return a.exec();
}
//--------------------------------End of main.cpp------------------------------//
//-----------------------------mainwindow.cpp----------------------------------//
//-----------------------------QT specific headers-----------------------------//
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QApplication>
#include <QLabel>
//-----------------------------------------------------------------------------//
//--------------------------------C program specific headers------------------//
#include <stdio.h>
#include <stdlib.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/types.h>
//---------------------------------------------------------------------------//
unsigned char message[50];
QString mystr;
int funct_class:: udp_config()
{
int sock_fd=0;
if ((sock_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
perror("\nError creating socket\n");
//mystr = "\nError creating socket\n";
else
{
fprintf(stdout, "\nSuccessfully created socket with descriptor:%d\n", sock_fd);
//mystr = "Successfully created socket";
struct sockaddr_in sock_addr = {0};
sock_addr.sin_family = AF_INET;
sock_addr.sin_port = htons(PORT);
if (inet_aton("127.0.0.1", &sock_addr.sin_addr) < 0)
perror("\nError converting destination IP address from dotted decimal to binary\n");
// mystr = "Error converting destination IP address from dotted decimal to binary";
else
{
if (bind(sock_fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)) < 0) // Bind function call binds the properties assigned above to the socket created earlier
perror("\nError binding the port and IP address with the socket\n");
//mystr = "Error binding the port and IP address with the socket";
else
fprintf(stdout, "\nBinding port and IP address successful\n");
// mystr = "Binding port and IP address successful";
}
}
return sock_fd;
}
void funct_class:: recv_fucnt(int sock_fd)
{
struct sockaddr_in recv_sockaddr = {0};
socklen_t recv_sockaddr_len = sizeof(recv_sockaddr);
int recv_data=0;
if ((recv_data = recvfrom(sock_fd, message, sizeof(message), 0x00, (struct sockaddr*)&recv_sockaddr, &recv_sockaddr_len)) <= 0)
perror("\nError receiving data/no data received\n");
//mystr = "Error receiving data/no data received";
else
fprintf(stdout, "\nSuccessfully received %d bytes of data\n", recv_data);
fprintf(stdout, "\nData is :%s", message);
//mystr = "Successfully received data";
mystr = QString::fromStdString((const char*)message);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->testedit->setText(mystr);
//ui->mytextbrowser->setText((mystr));
}
MainWindow::~MainWindow()
{
delete ui;
}
//-----------------------------End of mainwindow.cpp---------------------------//
//------------------------------------mainwindow.h-----------------------------//
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#define PORT 5030
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
class funct_class{
public:
int udp_config();
void recv_fucnt(int sock_fd);
};
#endif // MAINWINDOW_H
//-------------------------------End of mainwindow.h-----------------------------//
The application is compiling fine, but i am facing problems when i execute it. It just freezes and even if i manage to get it out from freeze, i am not able to display the required string either in the "text edit box" or "text browser box". Please help.
P.S.: I am a newbie to GUI programming and Cpp.
The issue seems to be pretty clear:
ui->testedit->setText(mystr);
This is only called in the constructor and nowhere else. That means, when your mystr is updated, the widget will not be aware of it. It does not work like you seem to expect; it is not a one-time property binding so that the widget will be be notified automatically and transparently when the string changes. You have to do that work on your own.
Beside, you really ought to aim for using QtNetwork in a Qt based client rather than platform specific POSIX API with BSD sockets.
This question already has an answer here:
Bind a QTcpSocket to a specific port
(1 answer)
Closed 2 years ago.
I'm using QTcpSocket to communicate between two applications. one is a c++ program and the other one is a web page written in PHP.
The goal is to send data from my webpage to my c++ program using sockets.
I don't know how to open a connection on a specific port e.g 12345 and listen to it if I got any data or not ..
I've written the following code so far:
MainWindow.cpp
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Mysocket = new QSocket(this);
Mysocket->Initialization();
}
MainWindow::~MainWindow()
{
delete ui;
}
QSocket.cpp
#include "qsocket.h"
#define SOCKET_PORT 12345
QSocket::QSocket(QObject *parent) :
QObject(parent)
{
}
void QSocket::Initialization()
{
//connected
socket = new QTcpSocket(this);
socket->connectToHost("localhost",SOCKET_PORT);
connect(socket,SIGNAL(connected()),this,SLOT(connected()));
connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected()));
connect(socket,SIGNAL(bytesWritten(qint64)),this,SLOT(bytesWritten(qint64)));
connect(socket,SIGNAL(readyRead()),this,SLOT(readyRead()));
if(!socket->waitForConnected(1000))
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(0,"Error","Error in Socket Connection",
QMessageBox::Yes|QMessageBox::No);
socket->close();
}
socket80->close();
}
void QSocket::connected()
{
QMessageBox::StandardButton reply;
int PortNumber = socket->localPort();
reply = QMessageBox::question(0,"Connected","Socket Connection is Established",
QMessageBox::Yes|QMessageBox::No);
qDebug()<<"I'm Listening to Port: "<<PortNumber<<"on the local host \n";
}
void QSocket::disconnected()
{
qDebug()<<"Disconnected .... \n";
socket->close();
}
void QSocket::bytesWritten(qint64 bytes)
{
qDebug()<<"We wrote "<<bytes<<" \n";
}
void QSocket::readyRead()
{
qDebug()<<"Reading .... \n";
qDebug()<<socket->bytesAvailable();
qDebug()<<socket->readAll();
}
When I run this code it doesn't open any connection and gives error and it enters into this if statement ..
if(!socket->waitForConnected(1000))
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(0,"Error","Error in Socket Connection",
QMessageBox::Yes|QMessageBox::No);
socket->close();
}
if I changed the port number to 80 it works fine and all the functions work properly.
By reading some posts in SO I've realized that a solution would be to use QTcpServer but I don't have any specific experience in it.
What's the problem in here ?!
P.S.
My Platform Specs.
Ubuntu 13.10
Qt 5.2.1
You can use the following sample server. You can start listening on a port by calling start_listen(int port_no).
#include <QtNetwork>
#include <QMessageBox>
class server : public QTcpServer {
Q_OBJECT
public:
explicit server(QObject *parent = 0);
~server();
QTcpSocket server_socket;
public slots:
void tcpReady();
void tcpError( QAbstractSocket::SocketError error );
bool start_listen(int port_no);
protected:
void incomingConnection( int descriptor );
};
server::server(QObject *parent) : QTcpServer(parent) {
connect( &server_socket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(tcpError(QAbstractSocket::SocketError)) );
connect( &server_socket, SIGNAL(readyRead()),
this, SLOT(tcpReady()) );
server_socket.setSocketOption(QAbstractSocket::KeepAliveOption, true );
}
server::~server() {
server_socket.disconnectFromHost();
server_socket.waitForDisconnected();
}
void server::tcpReady() {
QByteArray array = server_socket.read(erver_socket.bytesAvailable());
}
void server::tcpError(QAbstractSocket::SocketError error) {
QMessageBox::warning( (QWidget *)this->parent(), tr("Error"),tr("TCP error: %1").arg( server_socket.errorString() ) );
}
bool server::start_listen(int port_no) {
if( !this->listen( QHostAddress::Any, port_no ) ) {
QMessageBox::warning( (QWidget *)this->parent(), tr("Error!"), tr("Cannot listen to port %1").arg(port_no) );
}
else
return true;
}
void server::incomingConnection(int descriptor) {
if( !server_socket.setSocketDescriptor( descriptor ) ) {
QMessageBox::warning( (QWidget *)this->parent(), tr("Error!"), tr("Socket error!") );
return;
}
}