Board index » Visual Studio » WinSock nightmare

WinSock nightmare

Visual Studio262
hi



i have written a server and client application which

gathers stats data using another app (Statapp),Statapps

is also written in VB and complied to exe. Statapp accept

shell parameters and send messages to my server about the

its progress (wether sampling has started, completed or

error has occured). All the messages are passed

successfully in started and completed case but if user

close the the gui of Atatapp no message is sent to

server. i have writen the following code in Query_Unload.



Private Sub Form_QueryUnload(Cancel As Integer,

UnloadMode As Integer)

'checking the state of TCPSocket

If TCPSocket.State = 7 Then

MsgBox " Sampling process has been intrupted ." _

& vbCrLf & " Sending status to server.",

vbCritical, "Process Intrupted" message = "ERROR"

+ tokenSeperator + profiles.ProfileNumber +

tokenSeperator +

profiles.SampleNumber + tokenSeperator +

profiles.SID + endOfFile

sendToServer (message)

Timer1.Enabled = False

Timer2.Enabled = False

Timer3.Enabled = False

TCPSocket.Close

Else

MsgBox "Not Connected ."

End If

End Sub



TCPSocket check returns true (i.e that Statapp is still

connected to my server)



can any one help in this prob



TIA

SC


-
 

Re:WinSock nightmare

Try putting a DoEvents in right after your SendToServer call.





On Mon, 20 Oct 2003 03:30:13 -0700, "scoepio"

<anonymous@discussions.microsoft.com>wrote:



Quote
hi



i have written a server and client application which

gathers stats data using another app (Statapp),Statapps

is also written in VB and complied to exe. Statapp accept

shell parameters and send messages to my server about the

its progress (wether sampling has started, completed or

error has occured). All the messages are passed

successfully in started and completed case but if user

close the the gui of Atatapp no message is sent to

server. i have writen the following code in Query_Unload.



Private Sub Form_QueryUnload(Cancel As Integer,

UnloadMode As Integer)

'checking the state of TCPSocket

If TCPSocket.State = 7 Then

MsgBox " Sampling process has been intrupted ." _

& vbCrLf & " Sending status to server.",

vbCritical, "Process Intrupted" message = "ERROR"

+ tokenSeperator + profiles.ProfileNumber +

tokenSeperator +

profiles.SampleNumber + tokenSeperator +

profiles.SID + endOfFile

sendToServer (message)

Timer1.Enabled = False

Timer2.Enabled = False

Timer3.Enabled = False

TCPSocket.Close

Else

MsgBox "Not Connected ."

End If

End Sub



TCPSocket check returns true (i.e that Statapp is still

connected to my server)



can any one help in this prob



TIA

SC



-

Re:WinSock nightmare

thanks it works with doevents

SC

Quote
-----Original Message-----

Try putting a DoEvents in right after your SendToServer

call.





On Mon, 20 Oct 2003 03:30:13 -0700, "scoepio"

<anonymous@discussions.microsoft.com>wrote:



>hi

>

>i have written a server and client application which

>gathers stats data using another app (Statapp),Statapps

>is also written in VB and complied to exe. Statapp

accept

>shell parameters and send messages to my server about

the

>its progress (wether sampling has started, completed or

>error has occured). All the messages are passed

>successfully in started and completed case but if user

>close the the gui of Atatapp no message is sent to

>server. i have writen the following code in

Query_Unload.

>

>Private Sub Form_QueryUnload(Cancel As Integer,

>UnloadMode As Integer)

>'checking the state of TCPSocket

>If TCPSocket.State = 7 Then

>MsgBox " Sampling process has been intrupted ." _

>& vbCrLf & " Sending status to

server.",

>vbCritical, "Process Intrupted" message

= "ERROR"

>+ tokenSeperator + profiles.ProfileNumber +

>tokenSeperator +

>profiles.SampleNumber + tokenSeperator +

>profiles.SID + endOfFile

>sendToServer (message)

>Timer1.Enabled = False

>Timer2.Enabled = False

>Timer3.Enabled = False

>TCPSocket.Close

>Else

>MsgBox "Not Connected ."

>End If

>End Sub

>

>TCPSocket check returns true (i.e that Statapp is still

>connected to my server)

>

>can any one help in this prob

>

>TIA

>SC



.



-