Page 1 of 1

Is there any way to debug xml-rpc controllers (connections)?

Posted: 09 Apr 2013, 22:23
by TGYoshi
I'm trying to code an xml-rpc controller thingy, but because I don't seem to follow the correct protocol the server gets mad at me and closes the connection (winsock error 10054).
Is there any way to find out WHY it closes the connection? It just drops me off and I'm kinda lost now.
The handshake works fine, but when I call a method it starts derping.

If anyone wants to look at it anyway;

This code causes it:

Code: Select all

void sendMethod(string xml) {
	char *str = (char*)xml.c_str();
	int x = (int)strlen(str);
	int x2 = htonl(x);
	int y = 1;
	int y2 = htonl(y);

	send( ConnectSocket, (char*)&x2, 4, 0 );
	send( ConnectSocket, (char*)&y2, 4, 0 );
	send( ConnectSocket, str, x, 0 );
	cout << str << endl;
	cout << "len: " << x << " - " << x2 << " - " << endl;
	cout << "Sent!" << endl;
}
Sent XML: (both str and xml)
<?xml version="1.0"?><methodCall><methodName>EnableCallbacks</methodName><params><param><value><boolean>1</boolean></value></param></params></methodCall>
Other output:
len: 153 - -1728053248 -
If anyone got an idea why it derps or knows how to see some kind of error, feel free to tell me.

Thanks,

~TGY

Re: Is there any way to debug xml-rpc controllers (connectio

Posted: 10 Apr 2013, 14:43
by Speljohan
I don't see any references to actually packing the xml data, that's probably what you're missing :) The protocol employed for this is actually wrongfully referred to as xml-rpc, when in reality it breaks half of the official spec.

Re: Is there any way to debug xml-rpc controllers (connectio

Posted: 10 Apr 2013, 15:23
by TGYoshi
Fixed it, setting the rechandle param to 0x80000000 + 1 did the job.
A night of sleep seems to help a lot.