Prblem building the example_button1 event client
#1
I've been trying to build the example_button1 example event client as a preliminary to building a more sophisiticated client. I downloaded example_button1.cpp and xbmcclient.h from http://trac.xbmc.org/browser/branches/li...entClients and compiled it with:

cl -EHsc example_button1.cpp wsock32.lib
(Visual Studio 2005)

I add to add WSAStartip and WSACleanup, and I commented out the #include <sys/socket.h> to make it compile. Once I'd done this it built with no errors.

However when I run the executable it the "HeloPackage.Send" call fails i.e. returns 0. If I modify the line:

CAddress my_addr; // Address => localhost on 9777

to be

CAddress my_addr("192.168.128.128", 9777);

where 192.168.128.128 is my IP address, then HeloPackage.Send and the other .Send calls return 1, so they apparently work, but nothing gets sent. The example is supposed to send keystroke S then keystroke return. However nothing is received in XBMC.

I wrote a simple UDP listener and set it to listen on port 9777, but when I run the example no connection is received, so there's something wrong with the example.

Before I fire up the debugger to try and see what's happening is there anything obvious I've missed?

Also is the eventclient api documented anywhere? I was thinking of knocking up a quick test client in .Net to try and pin down the problem.

Thanks,

John Rennie
Reply
#2
Ok, I've worked out what's wrong. The example code is using the same CAddress (specifically the same sockaddr_in) for both the source and destination. Therefore it's trying to use the same port for both ends. Does this work on Unix? It certainly doesn't on Windows so i suspect it's a bug in the code.

Do I need to notify anyone?

John Rennie
Reply
#3
Please open a ticket on trac about it, with your proposed changes, and we'll make sure the appropriate dev takes a look.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
jhsrennie Wrote:... I add to add WSAStartip and WSACleanup, and I commented out the #include <sys/socket.h> to make it compile. Once I'd done this it built with no errors. ...
This is not needed, it should work ifdef _WIN32 though visual studio did that automaticly?

jhsrennie Wrote:CAddress my_addr; // Address => localhost on 9777

to be

CAddress my_addr("192.168.128.128", 9777);
Cant say for windows but if you use the first code it uses port 9777 and addr_any which on linux it seems to bind to localhost (was a while since i cooked up this so my socket language is rusty)

But it might need changing to 127.0.0.1 to make it work stable on windows aswell.

Edit: It seems to be a bug concerning example_button1.cpp
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#5
The example_button1.cpp example, and probably the other examples as well, are badly out of date. I'd guess the eventclient stuff in XBMC has changed during development and the examples need updating.

I have managed to get example_button1 working, but I'm not sure I fully understand how the api works so I'm reluctant to post my changes unless one of the developers is willing to look them over first.
Reply

Logout Mark Read Team Forum Stats Members Help
Prblem building the example_button1 event client0