Thank you, I had already read these links before asking my question.
I understand the process starting from the GBT request, as this question said
http://bitcoin.stackexchange.com/a/13397.
The thing I can't understand is what to do BEFORE sending the GBT request. Is there any particular procedure to connect to the server?
For example, after subscribing to a mining pool from its website, what do I have to do to connect to its server?
I suppose I need to login in some way, giving my username or a password or something like that. Isn't it?
What kind of request should I send? An HTTP POST request? I can't find any way to understand this.
Please sorry me if I am asking silly questions.
EDIT: I have been noticed about the stratum protocol. Seems to be lightweight and this page seems to talk about everything I need.
Is there any C library for this?
http://mining.bitcoin.cz/stratum-mining