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 -