Simple client server - "software caused connection abort"

A general discussion forum.
Posts: 2
Joined: 23 Jul 2012, 18:50

Simple client server - "software caused connection abort"

Postby pbaumer » 30 Jul 2012, 19:48


I am a newbie in network programming, so this can be a stupid question. I am trying to program a server which gets messages from a simple client every 1 second. After a few messages are sent successfully to the server, "software caused connection abort" exception is thrown. I guess I am doing something fundamentally wrong. I couldn't figure out what is wrong.

Client looks like:

Code: Select all

         StreamSocket ss;
         ss.connect(SocketAddress("localhost", m_heartBeatPort));
         for( int i = 0 ; i < 5 ; i++ )
            std::cout << "Testexe.exe is counting " << i << "/5" << std::endl;

            std::string msg = m_heartBeatStr + Poco::NumberFormatter::format(i);
            ss.sendBytes( msg.c_str(), msg.size() );


and the listening server thread is:

Code: Select all

void ListeningServerThread::run()

   Poco::Net::ServerSocket serverSocket(SocketAddress("localhost", m_port));
   Poco::Timespan span(250000);

   while( !_stop )
      // Read message from sender
      if (serverSocket.poll(span, Socket::SELECT_READ))
         StreamSocket ss = serverSocket.acceptConnection();

         char buffer[256];
         int n = ss.receiveBytes(buffer, sizeof(buffer));

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests