Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <SFML/Network.hpp>
- using namespace sf;
- void client()
- {
- TcpSocket client;
- std::cout << "Connecting\n";
- if( client.connect( "127.0.0.1", 55000 ) != Socket::Done )
- {
- std::cout << "Client does not werk.\n";
- }
- std::cout << "Client end\n";
- }
- void server()
- {
- TcpListener server;
- TcpSocket connection;
- std::cout << "Listening\n";
- server.listen( 55000 );
- std::cout << "Accepting\n";
- if( server.accept( connection ) != Socket::Done )
- {
- std::cout << "Server does not werk.\n";
- }
- std::cout << "Server end\n";
- }
- int main()
- {
- char ch;
- std::cin >> ch;
- if( ch == 's' )
- {
- server();
- }
- else
- {
- client();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement