Changeset 5 in libcf++ for trunk/test/test.cpp


Ignore:
Timestamp:
03/21/15 19:54:07 (9 years ago)
Author:
cheese
Message:

#1 get address from local socket or peer socket

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test.cpp

    r4 r5  
    213213        {
    214214            client.attach(server.accept().detach());
     215            cf::network::host peer = client.peer();
     216            std::cout << "client <"
     217                      << peer.address() << ":" << peer.port()
     218                      << "> is connected"
     219                      << std::endl;
    215220            msg = client.receive();
    216221            client.send(msg);
     
    237242    {
    238243        cf::network::tcp client;
     244        cf::network::host host(HOST, PORT);
     245
    239246        cf::ulong_t tid = cf::task::thread::id();
    240247        cf::bin msg(STR(STRING << " " << tid).c_str());
    241248        cf::bin response;
    242249
    243         client.connect(HOST, PORT, TIMEOUT);
     250        client.connect(host, TIMEOUT);
    244251        client.send(msg);
    245252        response = client.receive();
Note: See TracChangeset for help on using the changeset viewer.