Okay, I typed up the code under the Networking tutorial for SFML and included <thread>
#include <iostream>
#include <thread>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include "ResourcePath.hpp"
using namespace sf;
using namespace std;
int main(){
RenderWindow window(VideoMode(800, 600), "SFML Networking - MarcuzPwnz");
cout << "Would you like to be a server or client? (c/s)" << endl;
char input = ' ';
cin >> input;
if(input == 'c'){
/* CLIENT */
TcpSocket socket;
socket.connect("localhost", 1337);
string message = "Hey, I'm the client!";
socket.send(message.c_str(), message.size() + 1);
char buffer[1024];
size_t received = 0;
socket.receive(buffer, sizeof(buffer), received);
cout << "[Server]: " << buffer << endl;
}else{
/* SERVER */
TcpListener listener;
listener.listen(1337);
TcpSocket socket;
listener.accept(socket);
cout << "Client connected: " << socket.getRemoteAddress() << endl;
char buffer[1024];
size_t received;
socket.receive(buffer, sizeof(buffer), received);
cout << "Client: " << buffer << endl;
string message = "Welcome client!";
socket.send(message.c_str(), message.size() + 1);
}
while(window.isOpen()){
Event event;
while(window.pollEvent(event)){
}
}
return 0;
}
The code runs fine without #include <thread> on the second line, but with it I get errors.
Error: Lexical or Preprocessor Issue. 'thread' file not found.
Thanks for the reply.