Sorry noob here. Heard 1.6 had bugs and kinda turned me away from downgrading to it just to learn the ropes. But i tried using the network example in the docs. Copied the server code into a new project. Here is the code:
// Create a listener to wait for incoming connections on port 55001
#include <SFML\Network.hpp>
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
#include <iostream>
using namespace std;
sf::UdpSocket listener;
listener.listen(55001);
// Wait for a connection
sf::UdpSocket socket;
listener.accept(socket);
cout << "New client connected: " << socket.getRemoteAddress() << std::endl;
// Receive a message from the client
char buffer[1024];
std::size_t received = 0;
socket.receive(buffer, sizeof(buffer), received);
std::cout << "The client said: " << buffer << std::endl;
// Send an answer
std::string message = "Welcome, client";
socket.send(message.c_str(), message.size() + 1);
I'm getting a whole bunch of weird errors... errors with cout even though I have iostream included. Confused help anyone?
EDIT:: Both socket.recieve and socket.send give me an error of this specifier has no storage class or type specifier listener. listen same thing. cout same thing and it the "<<" giver error expected a declaration. This is the only file in the project. main.cpp.