No Such Signal Qtcpsocket Error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up QTcpSocket and multiples clients (signal issue) up vote 2 down vote favorite I'm developing a server that responds multiple connections from a client. But I have a problem where I have not found any solution. I created a class (TcpSocket) for QTcpSocket, which separates the signals and slots for each connection. But my server is not recognizing the signal of this class, it looks for QTcpSocket, and not by TcpSocket. I'll post the code, maybe you understand better, because my English is not good. tcpsocket.h #ifndef TCPSOCKET_H #define TCPSOCKET_H #include
QtForum.org » Qt » Qt Programming » QTcpSocket::QAbstractSocket::connected() Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here. Skip user information jnadelman Beginner Posts: 23 1 Monday, May 3rd 2010, 9:15pm QTcpSocket::QAbstractSocket::connected() I create a socket like this: Source http://stackoverflow.com/questions/25960970/qtcpsocket-and-multiples-clients-signal-issue code 1 tcpSocket = new QTcpSocket(this); I connect the socket like this: Source code 1 tcpSocket->connectToHost(ui->hostLineEdit->text(), ui->portLineEdit->text().toInt()); My error handling works fine (I get errors as expected) like this: Source code 1 connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError())); But I get the following complaint: Object:: Source code 1 connect: No such signal QTcpSocket::QAbstractSocket::connected() When I do a Quoted connect(tcpSocket, SIGNAL(QAbstractSocket::connected()), this, SLOT(displayConnected())); This http://www.qtforum.org/article/32653/qtcpsocket-qabstractsocket-connected.html make no sense at all since there is clearly a connected() signal. Any help appreciated. Thanks, Jack This post has been edited 1 times, last edit by "jnadelman" (May 3rd 2010, 9:29pm) Go to the top of the page Skip user information Messenger Professional Posts: 1,289 Location: Lt 2 Tuesday, May 4th 2010, 7:49am Perhaps Quoted connect(tcpSocket, SIGNAL(connected()), this, SLOT(displayConnected())); Fighting fire with fire. Three can keep a secret if two of them are dead. Go to the top of the page Skip user information jnadelman Beginner Posts: 23 3 Tuesday, May 4th 2010, 12:33pm Source code 1 connect(tcpSocket, SIGNAL(connected()), this, SLOT(displayConnected())); worked great. Thanks a million. Jack Go to the top of the page Jump to: ----------------------- QtForum.org QtForum Tutorials, Tips and snippets Qt Qt Embedded, Qtopia, QSA Qt Programming KDE Development Qt Designer Installing Qt Other Forums C++ programming Offtopic Job Forum commercial jobs non commercial Help Legal Notice Terms of use Friday, October 21st 2016, 2:47pm Go to the top of t
download a browser that supports JavaScript, or enable it if it's disabled (i.e. https://forum.qt.io/topic/17200/how-to-share-signals-and-slots-between-different-classes NoScript). Home Qt Development General and Desktop How to share signals and slots between different classes? How to share signals and slots between different classes? This http://www.informit.com/articles/article.aspx?p=1405552&seqNum=3 topic has been deleted. Only users with topic management privileges can see it. roboterprogrammer last edited by Hi, first let me introduce the programm situation: no such The programm connects to an TCPIP Server, and it launches its own TCPIP Server, where a client connects to. From the connected Server, the programm receives Info-Lines, which are written in a txt-file, this is done in an extra class "tcpclient", and now the missing part is, that always when no such signal a new line is there (readyread), the textbrowser of the ui should refresh this data. how do i make the connection? the ui is initialisiated by @Robbie20 w; w.show();@ and i have a loadtextfile method @void Robbie20::loadTextFile() { QDate date = QDate::currentDate(); QString datum = date.toString("yyyyMMdd"); QFile inputFile("c://LOGS/" + datum + ".txt"); inputFile.open(QIODevice::ReadOnly); QTextStream in(&inputFile); QString line = in.readAll(); inputFile.close(); ui->textBrowser->setPlainText(line); QTextCursor cursor = ui->textBrowser->textCursor(); cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1); } @ so how can i run this method from the class tcpclient, always, when the signal "readyread" occurs, in a way, the browserwindow in the "w" ui will be refreshed? thanks for a hint. here the tcpclient class: @#include "tcpconnect.h" #include "robbie20.h" #include
and Receiving UDP Datagrams ⎙ Print + Share This Page 1 of 4 Next > This chapter shows how to write FTP and HTTP clients, TCP client-server applications, and how to send and receive UDP datagrams. This chapter is from the book This chapter is from the book C++ GUI Programming with Qt4, 2nd Edition Learn More Buy This chapter is from the book This chapter is from the book C++ GUI Programming with Qt4, 2nd Edition Learn More Buy 15. Networking Writing FTP Clients Writing HTTP Clients Writing TCP Client–Server Applications Sending and Receiving UDP Datagrams Qt provides the QFtp and QHttp classes for working with FTP and HTTP. These protocols are easy to use for downloading and uploading files and, in the case of HTTP, for sending requests to web servers and retrieving the results. Qt also provides the lower-level QTcpSocket and QUdpSocket classes, which implement the TCP and UDP transport protocols. TCP is a reliable connection-oriented protocol that operates in terms of data streams transmitted between network nodes, and UDP is an unreliable connectionless protocol based on discrete packets sent between network nodes. Both can be used to create network client and server applications. For servers, we also need the QTcpServer class to handle incoming TCP connections. Secure SSL/TLS connections can be established by using QSslSocket instead of QTcpSocket. Writing FTP Clients The QFtp class implements the client side of the FTP protocol in Qt. It offers various functions to perform the most common FTP operations and lets us execute arbitrary FTP commands. The QFtp class works asynchronously. When we call a function such as get() or put(), it returns immediately and the data transfer occurs when control passes back to Qt's event loop. This ensures that the user interface remains responsive while FTP commands are executed. We will start with an example that shows how to retrieve a single file using get(). The example is a console application called ftpget that downloads the remote file specified on the command line. Let's begin with the main() function: int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QStringList args = QCoreApplication::arguments(); if (args.count() != 2) { std::cerr << "Usage: ftpget url" << std::endl << "Example:" << std::endl << " ftpget ftp://ftp.trolltech.com/mirrors" << std::endl; return 1; } FtpGet getter; if (!getter.getFile(QUrl(args[1]))) return 1; QObject::connect(&getter, SIGNAL(done()), &app