wxYield Topic is solved

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
johnnie
Experienced Solver
Experienced Solver
Posts: 64
Joined: Mon Jan 14, 2008 8:59 am
Location: Bangalore
Contact:

wxYield

Post by johnnie »

Is there any possibility of changing the order in which the events being processed.

For Example.... My Socket event is now in wxSOCKET_INPUT. In this Event I am making the server to sleep. While sleeping I am Disconnecting and again connecting the client.

After awaking from the sleep, I am calling wxYield().The Connect is being processed first and then the wxSOCKET_LOST event.

But I need to get wxSOCKET_LOST event first and the CONNECT Event at second :?:
--johnniealan --
mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r »

Have you tried calling wxYield or wxApp::Yield after the disconnect instead of waiting until after the waking from sleep?

-Max

EDIT: I re-read this do you mean you are disconnecting and reconnecting some external client? and not doing this in your app?
johnnie
Experienced Solver
Experienced Solver
Posts: 64
Joined: Mon Jan 14, 2008 8:59 am
Location: Bangalore
Contact:

Post by johnnie »

Yeah I have two client external. Both not within the same application.

Can you give small overview of how the events are being processed.(i.e) the order in which it is processed.

whether the events sre randomly taken from the queue and processed or does it have any priority.

I got some thing from the events overview that, the events processing starts from the base just as like the virtual functions in C++. Is this right

class socketBase

class socketServer : public socketBase
--johnniealan --
mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r »

johnnie wrote:whether the events sre randomly taken from the queue and processed or does it have any priority.
I don't think there is any way to determine what order the events will be processed in. They should , "generally", be processed in the order they are posted, but I don't think there are any guaranties of that.
johnnie wrote:I got some thing from the events overview that, the events processing starts from the base just as like the virtual functions in C++. Is this right

class socketBase

class socketServer : public socketBase
I am not sure what you are getting at here. your connect event and connection closed event are siblings of each other and class hierarchy has nothing to do with the order they are processed in.

The wxSOCKET_LOST is sent to indicate that the already open session was closed.

The wxSOCKET_CONNECTION is sent to indicate that there is a new incoming connection.

These two events are seperate and refer to seperate connection so it shouldn't matter what order they are processed in. Normally on a wxSOCKET_CONNECTION you would create a new instance of a connection class (something you would make yourself) to handle that connection and it would then take care of closing the socket and/or cleanup in the event of a wxSOCKET_LOST event and also any incoming data etc... Or you could alternativly keep an array/vector/hash/whatever of connections instead of a connection class.

But either way these events refere to seperate connections and your server code should be able to handle them in what ever order they come in. you will never be able to predict what order 2/3/4+ clients would open or close their connections in or send recieve data.

Hope this helps some

-Max
johnnie
Experienced Solver
Experienced Solver
Posts: 64
Joined: Mon Jan 14, 2008 8:59 am
Location: Bangalore
Contact:

Post by johnnie »

Thanks Max thats great.. Helped me a lot
--johnniealan --
Post Reply