Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow trigger from Named Pipes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00913257
Message ID:
00913259
Vues:
22
Hi Sergey,

Tried it on VFP8 and VFP9 both got the same problem. Extracted code below.

Nick


Code extract from Server:
lHandle = CreateMailslot ("\\.\mailslot\testing\my_comments", 0,0,0)
LOCAL lnMsgSize, lnNextSize, lnMsgCount, lnTimeout
IF lHandle>0
lnOld=SECONDS()
DO WHILE .T.
STORE 0 TO lnMsgSize, lnNextSize, lnMsgCount, lnTimeout
GetMailslotInfo (lHandle, @lnMsgSize, @lnNextSize,;
@lnMsgCount, @lnTimeout)
IF lnNextSize>0
chRequest = SPACE(800)
cbBytesRead = 0
doevents
ln1=SECONDS()
lnRes=ReadFile( ;
lHandle, ;
@chRequest, ;
800, ;
@cbBytesRead, ;
NULL)
ln2=SECONDS()
doevents
IF cbBytesRead>0
?"ReadFile: ", lnRes
?"Read: ",cbBytesRead
?SUBSTR(chRequest, 1, 100)
?ln1, ln2,"took: ",ln2-ln1, ln1-lnOld
EXIT
ENDIF
lnOld=ln1
ENDIF
SLEEP(1)
ENDDO
ENDIF

Code extract from client:
lcSend = "test message *******************"+SPACE(50)+"********* end"
lHandle = CreateFile("\\.\mailslot\testing\my_comments", GENERIC_WRITE, ;
FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, null)
IF lHandle>0
cbWritten=SPACE(4)
doevents
ln1=SECONDS()
lnRes=WriteFile(lHandle, lcSend, LEN(lcSend), @cbWritten, NULL)
ln2=SECONDS()
doevents
?"WriteFile: ", lnRes, "written: ",Asc2Long(cbWritten)
?ln1,ln2,"took: ",ln2-ln1
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform