1
Network / Re: [SMFL 2] Using TcpListener
« on: April 26, 2013, 06:05:48 pm »
I meant Socket.Done (Also = 0 in the Status enum). Anywho, got it working now anyway.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
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;
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();