473,398 Members | 2,389 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,398 software developers and data experts.

help: messagebox-like delay?

hi, i created a windows application that uses winsock control.
in the closing event, it sends a "Disconnect" string message.
the server (listening application) does not receive this message.

also in the closing event, a Messagebox is shown when not all values
have been saved.
when this is shown, the "Disconnect" message is received by the
listening application.

in most times, the messagebox is not shown.
my question is, how can the message be sent?
i tried thread.sleep and lock but it does not work.

btw, i am using .net 1.1 / Visual studio 2003

May 11 '07 #1
2 2965
Hi,

Would you mind posting some code?

Are you doing a Flush before closing teh connection?

Is the connection in another trehad?

"Risa" <ri**********@gmail.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
hi, i created a windows application that uses winsock control.
in the closing event, it sends a "Disconnect" string message.
the server (listening application) does not receive this message.

also in the closing event, a Messagebox is shown when not all values
have been saved.
when this is shown, the "Disconnect" message is received by the
listening application.

in most times, the messagebox is not shown.
my question is, how can the message be sent?
i tried thread.sleep and lock but it does not work.

btw, i am using .net 1.1 / Visual studio 2003

May 11 '07 #2
i use winsock control
i don't close the connection. the server just waits for a message.

private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
try
{
if (m_bIsConnectedToEDAS)
{
SendMessage("Disconnect");
}

if (bDataNeedsUpdate)
{
DialogResult dr = MessageBox.Show("Do you want to save before
continuing?","
Application",MessageBoxButtons.YesNoCancel,Message BoxIcon.Question,MessageBoxDefaultButton.Button1);

if (dr == DialogResult.Yes)
{
Save();
}

if (dr == DialogResult.No)
{
return;
}
catch
{ // some code

}
finally
{// some code}
}

private void SendWinsockMessage(string sMessage)
{
try
{
winSock1.SendData(sMessage);
}
catch (Exception ex)
{ // some code
}
}

On May 12, 2:21 am, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,

Would you mind posting some code?

Are you doing a Flush before closing teh connection?

Is the connection in another trehad?

"Risa" <riscasamb...@gmail.comwrote in message

news:11**********************@h2g2000hsg.googlegro ups.com...
hi, i created a windows application that uses winsock control.
in the closing event, it sends a "Disconnect" string message.
the server (listening application) does not receive this message.
also in the closing event, a Messagebox is shown when not all values
have been saved.
when this is shown, the "Disconnect" message is received by the
listening application.
in most times, the messagebox is not shown.
my question is, how can the message be sent?
i tried thread.sleep and lock but it does not work.
btw, i am using .net 1.1 / Visual studio 2003- Hide quoted text -

- Show quoted text -

May 11 '07 #3

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

Similar topics

2
by: | last post by:
Hi all, continued from yesterday's posting... I still haven't found a solution to this issue. I put a breakpoint in private void SqlBackupPercentComplete(string message, int Percent) {...
1
by: | last post by:
Hi all I am posting this to check if anyone could help me. The problem still persists. I am beginner in C#. Thanks. Subject: SQLDMO.Backup and ProgressBar - help please From: ...
4
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing...
2
by: ttan | last post by:
How do I write a Messagebox with print out the dot (...) to notify user to wait for 5 minutes before I go to next step. I want to Messagebox to print out the dot (...) every 5 second and no need...
4
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following...
0
by: noe | last post by:
I have done a DLL in unmanaged code C++ and in that dll I have defined a function that use memcpy.This dll run ok.I use that dll in a aplication in C# managed code in Visual Studio .NET. I import...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
1
by: laura salhuana | last post by:
Hi: I am trying to write a serial communication GUI application. My application has the following specifications. When I set my board up in hyperterminal I do the following set up: bits per...
0
by: jdprime | last post by:
Hi, I am making a webform, and am trying to populate a dropdownlist with a dataset from a called stored procedure. This is where I run into two problems: 1: How do I get the dropdownlist to...
4
by: aprillynn82 | last post by:
I can not seem to get the code correct to calculate shipping charges based on weight and distance. The info is: Weight of the Package (in kilograms) / Shipping rate per Mile 2kg or less / $0.01...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.