Click to See Complete Forum and Search --> : Ethernet in Multitaskiung application


zvivered
June 4th, 2007, 02:57 PM
My MFC application contains several tasks. All tasks must have the capability to send messages over ethernet (UDP) via the same ethernet device (card) and the same port (e.g 5000).

The tasks are not synchronised and can send the messages any time.

Each message is less than 64K bytes.

The socket is opened before all tasks are created. The socket is passed as parameter to all tasks.

One option is to call "send" directly from the tasks.
Can windows handle this ?
This is the solution I prefare.

Another option is to send windows message to a mediator task which will be responsible to send the messages via ethernet.

Thanks.

pupito
June 4th, 2007, 04:53 PM
....
One option is to call "send" directly from the tasks.
Can windows handle this ?
....

I have not idea what "MFC Tasks" means but generally you must serialize the "send" calls in a multi thread/processes environment in which multiple threads/processes access the same socket.

Use critical sections or unnamed mutexes in multi threads environment or named mutexes in multi processes ones