Hi guys.
I'm trying to use the network module of the 2.0 rc to create a simple Server/Client that can send and receive some basic data. I've read through the tutorial and searched the forum best I can, but I can't find anything similar to the problem. First off, I'll post some code snips.
Server code:
TcpListener Host;
if(!Host.listen(50000))
return;
TcpSocket socket;
Host.accept(socket);
cout << "New Client Connected: " << socket.getRemoteAddress() << endl;
char ToSend[] = "Success";
socket.send(ToSend, sizeof(ToSend));
cout << "Message sent to client : \"" << ToSend << "\"" << endl;
Client code:
TcpSocket Client;
Client.setBlocking(false);
if(Client.connect("localhost", 50000))
return;
char Message[128];
size_t Received;
Client.receive(Message, sizeof(Message), Received);
cout << "Message received! = \"" << Message << "\"" << endl;
char ToSend[] = "HELLOOOOOOOO";
Client.send(ToSend, sizeof(ToSend));
cout << "Message sent to server : \"" << ToSend << "\"" << endl;
Client.disconnect();
Basically, what happens is the code just hits the return and from what I can tell stops listening (Neglected to give its own thread, so if its listening it causes my UI to lock up atm). Sorry, about the pretty amateurish post, new to C++/Networking