473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Socket programming

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

Jul 23 '07 #1
2 1337
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

<li*********@yahoo.com.hkwrote in message
news:11*********************@z28g2000prd.googlegro ups.com...
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

Jul 23 '07 #2
li*********@yahoo.com.hk 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.
--
Rinze van Huizen
C-Services Holland b.v
Jul 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pyguy2 | last post by:
Issues of socket programming can be wierd, so I'm looking for some comments. In my python books I find exclusive use of socket.close(). From my other readings, I know about a "partial close...
5
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose...
1
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
5
by: mscirri | last post by:
The code below is what I am using to asynchronously get data from a PocketPC device. The data comes in fine in blocks of 1024 bytes but even when I send no data from the PocketPC constant blocks of...
2
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I...
10
by: Uma - Chellasoft | last post by:
Hai, I am new to VB.Net programming, directly doing socket programming. In C, I will be able to map the message arrived in a socket directly to a structure. Is this possible in VB.Net. Can...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
0
by: shonen | last post by:
I'm currently attempting to connect to a shoutcast server pull down the information from here and then I'll parse it. I got this working with the httplib, which was great, the problem is I want...
8
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi all, I am new to .net technologies. ASP.NET supports socket programming like send/receive in c or c++? I am developing web-site application in asp.net and code behind is Visual C#. In...
3
by: Stuart | last post by:
I am in the process of teaching myself socket programming. I am "playing around" with some simple echo server-client programs for m the book TCP/IP Sockets in C. The Server program is: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.