Hey I'm new to programming in QT and want to use a .h file from an existing project I created in Visual Studio that uses the winsock headers. In visual studio adding the wsock32.lib was easy through the project dependencies. How can I make it so my QT project is able to use the winsock headers. I know certain functions such as accept and connect may be already defined by QT specific headers and am wondering how to load and use the winsock headers. I have provided the .h file I am trying to use below and hope someone can help.
#ifndef CLIENT_S_
#define CLIENT_S_
#include <string>
#include <vector>
using namespace std;
class clientSession
{
private:
SOCKET initSocket;
int portNumber;
string host;
bool isSockInit;
public:
clientSession(const int, const string);
clientSession();
string receiveText() const;
void startConnection();
bool receiveAck() const;
bool sendRequest(const string) const;
bool socketCheck() const;
};
class messageSyntaxException
{
private:
string error;
public:
messageSyntaxException(const string);
const string what() const;
};
class remoteHostException
{
private:
string error;
public:
remoteHostException(const string);
const string what() const;
};
#endif
#ifndef CLIENT_S_
#define CLIENT_S_
#include <string>
#include <vector>
using namespace std;
class clientSession
{
private:
SOCKET initSocket;
int portNumber;
string host;
bool isSockInit;
public:
clientSession(const int, const string);
clientSession();
string receiveText() const;
void startConnection();
bool receiveAck() const;
bool sendRequest(const string) const;
bool socketCheck() const;
};
class messageSyntaxException
{
private:
string error;
public:
messageSyntaxException(const string);
const string what() const;
};
class remoteHostException
{
private:
string error;
public:
remoteHostException(const string);
const string what() const;
};
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks