Menu

Error code 111: write error

Help
Moritz
2007-11-14
2013-04-24
  • Moritz

    Moritz - 2007-11-14

    Hello,

    I'd like to use OpenDHT and for transmiting the XML I use XmlRpc++.

    But the Following code:
    "
        dht = new XmlRpcClient( "128.83.122.179", 5850, 0, false );
        unsigned char trans_key[100];
        CSHA1 transe;
        transe.Update( (unsigned char*)key.data() , key.size());
        transe.Final();
        transe.GetHash( trans_key );
       
        XmlRpcValue param_array;
        param_array.setSize( 5 );
        param_array[0] = XmlRpcValue("kpprog");
        param_array[1] = XmlRpcValue("xmlrpc++");
        param_array[2] = XmlRpcValue(trans_key);
        param_array[3] = XmlRpcValue((char *)value.data());
        param_array[4] = XmlRpcValue(604800);
        qDebug("vorput");
        if( !dht->execute("put", param_array, result) )
            qDebug("Error");
        qDebug("nachput");
    "
    gives out:
    vorput
    Error in XmlRpcClient::writeRequest: write error (error 111).
    Error
    nachput

    Does someone know what this mean? The Connection to the Server is correct(when i change the IP another error appears, that it couldnt connect to server).
    The server is from the official opendht server list:
    http://opendht.org/servers.txt

    thx for help,
    mollitz

     
    • Chris Morley

      Chris Morley - 2007-11-15

      Errno 111 is ECONNREFUSED ("Connection refused") - ie, no socket is accepting connections at that address.

      According to the OpenDHT User's Guide, the XML-RPC service is at port 5851.
      You are using port 5850.

       
    • Moritz

      Moritz - 2007-11-15

      thx for the quick answer the put is working now! (so the opendht server list is wrong)

          unsigned char trans_key[100];
          unsigned char bytearray[100];
          XmlRpcValue result;
          XmlRpcValue param_array;
          CSHA1 transe;
          transe.Update( (unsigned char*)key.data() , key.size());
          transe.Final();
          transe.GetHash( trans_key );
         
          param_array.setSize( 5 );
          param_array[0] = XmlRpcValue("kpprog");
          param_array[1] = XmlRpcValue("xmlrpc++");
          param_array[2] = XmlRpcValue(trans_key);
          param_array[3] = XmlRpcValue(100); //kp
          param_array[4] = XmlRpcValue(bytearray);
          qDebug("vorrequest");
          if( !dht->execute("get", param_array, result) )
              qDebug("Error");
          qDebug() << result.size();
          QString str(std::string(result[0]).c_str());
          qDebug("nachrequest");

      but theres another error, i cant find the reason for. the source code above gives the following:

      vorrequest
      2
      terminate called after throwing an instance of 'XmlRpc::XmlRpcException'

      do you know the reason ?

      thx, mollitz

       
    • Chris Morley

      Chris Morley - 2007-11-15

      You probably want to inspect the result type before using it. In general, to debug problems you should catch and print XmlRpcExceptions, enable the debug output in xmlrpc++, step through the code in a debugger, etc.

       

Log in to post a comment.