[Gambas-devel] Gambas Interface

danielcampos at ...45... danielcampos at ...45...
Wed Apr 28 08:42:44 CEST 2004


>
>...is sent to the parent automatically. You don't need accessing the >parent 
>yourself ?
>

 No, I think the problem is that i've explained my problem very bad, I don't know why I've used the word 'parent' if I was not exatly talking about objects but structures. I'll try to do it better:


I have a structure to define the socket class:

typedef struct
{
   GB_BASE *ob;
   GB_STREAM *stream,
   int socket;
   int iStatus;
   ...
} CSOCKET;

 I all the code, I can use the 'THIS' macro to reference the current 'Socket' object, so I can manage its 'internal  properties', (the members of that structure, I mean), and I can pass that pointer to the rest of the functions. 

 However, when I receive a call-back, the parameter that I receive is just the value of the socket descriptor, but I don't know where the structure that holds this socket descriptor (the 'parent':) is placed. So, I've created an array with CSOCKET pointers, and socket descriptors, and each time I receive a callback, I find the socket descriptor in the array, so I can obtain the value of the CSOCKET pointer, to be able to modify the rest of 'properties', for instance 'iStatus'.

 If I detect, for example, that connection was broken, in the 'write callback', I have to post an event, so I have to specify the CSOCKET pointer (the 'parent' of my socket descriptor)...

 I hope I've explained it better, as really my first question was very obscure :)

Regards,

Daniel Campos  

-------------------------------------------------------------
NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
Web/Wap : www.netcourrier.com
Téléphone/Fax : 08 92 69 00 21 (0,34 € TTC/min)
Minitel: 3615 NETCOURRIER (0,16 € TTC/min)





More information about the Devel mailing list