I wrote two comments where it`s a trouble. I`ll be realy happy if u help me. I love to make fails at start of learning something.
It works if i run it on my computer, but if i run it on the computer and laptop it isn`t works..
Windows 7, Visual studio 10.
// SERVER
int main()
{
std::cout<<"It`s start to work"<<std::endl;
sf::TcpListener listener;
listener.listen(21);
short int port = listener.getLocalPort();
std::cout<<port<<std::endl;
sf::TcpSocket socket;
listener.accept(socket);
std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;
getch();
}
// CLIENT
int main(){
sf::TcpSocket socket;
int port, port2;
sf::Socket::Status status = socket.connect("ip", 21); /* Is there i need to choose my ip? Or some specific
adress, becouse it doesn`t work with my ip adress : remote port show zero and no messages on the server
*/
if (status != sf::Socket::Done)
{
std::cout<<"error";
}
else {
std::cout<<"done"; }
port = socket.getRemotePort();
std::cout<<"Remote "<<port<<std::endl; /* here remote port show zero (i told about it) */
port2 = socket.getLocalPort();
std::cout<<"Local "<<port2<<std::endl;
getch();
}