Afternoon or it will be when I'm done writing this post.
I have issues. Many many issues. My program compiles fine, both of them rather. My troubles ensue when I have my server and client open. Nothing is displayed and nothing happens. I am utilizing the basic code from the official networking tutorial, all that has changed is the port.
Code is the same as tutorial pretty much but:
Server:
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
int main(){
sf::TcpListener listener;
// bind the listener to a port
if (listener.listen(53003) != sf::Socket::Done)
{
// error...
}
// accept a new connection
sf::TcpSocket client;
if (listener.accept(client) != sf::Socket::Done)
{
// error...
}
char data[100];
std::size_t received;
// TCP socket:
if (client.receive(data, 100, received) != sf::Socket::Done)
{
// error...
}
std::cout << "Received " << received << " bytes" << std::endl;
}
Client:
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
int main()
{
sf::TcpSocket socket;
sf::Socket::Status status = socket.connect("localhost", 53003);
if (status != sf::Socket::Done)
{
// error...
}
char data[100] = {'a'};
socket.send(data, 100);
}
The consoles display a blinking cursor and nothing else. I'm a noob with network programming. Enabled the port in my firewall, still nothing.
Edit 1:00 PM :
Server binds to port properly but client is unable to connect to the port. I feel as if it's something with my network.
I am running ubuntu 16.04. Not sure if something blocking something Fajsg;jaksjfg;lkajskrlgjlka. Yep.