Socket programming

  • Thread starter Thread starter linuxfedora
  • Start date Start date
L

linuxfedora

What is the best way to write the following application:

The Main GUI thread will try to send packet to other side in the
network, it could be very slow network or very fast network. How can i
ensure that the sending packet will not miss and the program is
effective?

I tried to use Socket::Send to send data, but if it is in a very slow
network, then it will block the main GUI for responding, right? Then
How can i acheive this purpose?

The packet the program needs to send is about 256kbyte per one and
send in 25 time per seconds.

Thanks
 
A GUI is a user interface. Its purpose is to provide interaction between the
user and the application. It is not intended to *do* any work, but should
provide an interface to the objects that do the work. So, first of all, your
GUI should not be trying to open a Socket or send anything. It should only
instruct the business object(s) to do so. It is also single-threaded.

Once you've separated the User Interface from the business classes, it's a
relatively simple matter for your business classes to run the Socket process
in a separate thread.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
(e-mail address removed) schreef:
What is the best way to write the following application:

The Main GUI thread will try to send packet to other side in the
network, it could be very slow network or very fast network. How can i
ensure that the sending packet will not miss and the program is
effective?

I tried to use Socket::Send to send data, but if it is in a very slow
network, then it will block the main GUI for responding, right? Then
How can i acheive this purpose?

The packet the program needs to send is about 256kbyte per one and
send in 25 time per seconds.

Thanks

As a side note, are you aware you're talking about 6.4megabytes per
second? While this is not a problem over a LAN, if you're intention is
to do this over the internet then you'll probably run out of bandwidth.

To make sure the package has arrived, you'll have make the receiver send
and acknowledgment package. If that doesn't arrive within the specified
time out, you'll know something is wrong.
 
Back
Top