Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Winsock Control Send Error
Message
De
12/06/2001 11:48:54
Josh Fedke
National Financial Corporation
Milwaukee, Wisconsin, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Winsock Control Send Error
Divers
Thread ID:
00518445
Message ID:
00518445
Vues:
283
Hello All:

Can Someone offer some help with a Winsock Control OLE error I'm getting?

I have a function called send_str() which uses a Winsock control to send a sring to another Winsock control. It looks something like this (more detail available upon request):

with thisform.winsock1

if type("thisform.Winsock1") = "O"
&& Set thisform.winsock1 members for port, host, and timeouts from config table
thisform.Winsock1.RemotePort = wsock_config.rport
&& etc...

do while .state != Socket_Connected and seconds()-start < Socket_Timeout
if .state = Socket_Error or .state = Socket_Closed
.close()
.connect()
endif
enddo

do case
case .state = Socket_Connected
.senddata(cSome_String)

...

This is where the problem occurs. I get an error that says "OLE IDispatch exception code 0 from Winsock: Wrong protocol or connection state for requested transaction or request." The strange thing is that the function will work 3 or 4 times before throwing this error. Some debug code shows that the control says it's state is "Socket_Closing" when I try to do the send. I can't figure out how the case statement that fires says the the socket is connected, but my next statement is .senddata which causes the the 'incorrect state' error. I call this code about every 1/10 of a second, but the use of while loops means the code doesn't procede until the control is in an appropriate state. I've also put wait windows with timeouts into the code to try to give the socket a chance to close, but to no avail. Any insights/similar experiences would be appreciated. Thanks in advance.

-Josh
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform