Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with WinSock, what´s happening here?
Message
De
25/04/2005 10:03:04
 
 
À
21/04/2005 08:00:09
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
01006357
Message ID:
01008070
Vues:
35
Yeah, thanks for the info, but I'm afraid that you didn't get what I'm saying.

Here´s the code for analysis.
thisform.tcpClient.object.Close()
thisform.tcpClient.object.Connect()
llShutdown = .F.
** SET STEP ON 
= INKEY(0.2,"H")
IF thisform.tcpClient.object.State = 7 &&Connected
	thisform.sentCommand="PING"
	thisform.lblStatus.Caption="Status: Sending command to server..."
	thisform.tcpClient.object.SendData(thisform.sentCommand+CHR(13)+CHR(10))	
	= INKEY(0.5,"H")		
	thisform.lblStatus.Caption = ALLTRIM(UPPER(thisform.serverMessage))	
	IF ALLTRIM(UPPER(thisform.serverMessage)) = "OK!"
		i = 0
		llStop = .F.
		DO WHILE i < 60 AND NOT llStop
			thisform.tcpClient.Object.Close()
			thisform.tcpClient.object.Connect()
			= INKEY(0.5,"H")
			IF thisform.tcpClient.object.State = 7 &&Connected
				thisform.sentCommand = "PING"
				thisform.tcpClient.object.SendData(thisform.sentCommand+CHR(13)+CHR(10))					
				= INKEY(0.8,"H")
				IF ALLTRIM(UPPER(thisform.serverMessage)) = "OK!"
					i = i + 1 
				ELSE
					IF NOT llDesligando
						thisform.lblStatus.Caption = "Status: The server is being shutdown..."
						= INKEY(15,"H")
						i = i + 1 
						llShutdown = .T.
					ELSE 
						thisform.lblStatus.Caption = "Status: Server successfully shutdown"
						llStop = .T.
					ENDIF 
				ENDIF
			ENDIF 
		ENDDO
		IF NOT llStop
			thisform.lblStatus.Caption = "Status: Timeout occurred while sending command"
		ENDIF 
	ELSE 
		thisform.lblStatus.Caption = "Status: Server offline"
	ENDIF 	
ENDIF 
WAIT CLEAR 
Well, notice the commented SET STEP ON there? when I run the code ignoring that line, server never returns anything. Whenever I uncomment the SET STEP ON line, server does return the OK! to the serverMessage property.

Here's the code for tcpClient.dataArrival:
*** ActiveX Control Event ***
LPARAMETERS bytestotal
lcServerMessage = SPACE(bytesTotal)
thisform.tcpClient.object.GetData(@lcServerMessage)
thisform.serverMessage = lcServerMessage
What is the problem here, then?

TIA again!
Pablo Márcio de Oliveira

Inside the scream is silent, inside it must remain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform