connect() to localhost requires network connection?

May 21, 2015 at 10:42 PM
We developed a POCO based WebSocket (WS) Server and a C++ REST SDK based WS Client.
The connection and communications works just fine :

[C++ REST SDK WS Client] <-> [POCO WS Server] <-> [Chrome WS Apps]

Except, when we tried on a computer which was not connected to the network (Windows7 Professional, SP1) the Chrome based WS Client Apps wore connecting but the C++ REST SDK WS Client connection attempt finished with an exception:
try 
      {     
                m_ws_client.connect(U("ws://localhost:65131")).wait();     
        }   
catch (const websocket_exception &e)
    {
        wcout << "\n\n\tERROR: " << e.error_code() << " mesg: " << e.what() << endl;
     }
 
 The exception printout ERROR:  
                     e.error_code()  = websocketpp.transport.asio:3
                      e.what()    =  set_fail_handler: 3: Underlying Transport Error  
The "connect" command is in a loop and this message repeated until we did not plugged in the Ethernet cable, when we established the WS Connection.

The question is why we need a network connection when everything is on the localhost?
Coordinator
May 26, 2015 at 5:30 PM
Hi SoosAntal,

I'm not aware of this restriction/requirement but perhaps it is a problem with the underlying Websocket++ library we build on. Let me try it out locally on one of my machines.

Steve
Coordinator
May 27, 2015 at 2:09 AM
Ok I just tried running our websocket client test cases which all use 'localhost' and didn't have any problems. Perhaps this is a localhost configuration issue on your machine? I was on a Windows 8.1 machine testing with Visual Studio 2013. What version of VS and of the C++ REST SDK are you using?

Steve
Jun 1, 2015 at 6:46 PM
Replace "localhost" with "127.0.0.1" and it should work offline.