Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default mswinsck.ocx

When you call senddata and you single step there is a lot of time (in
processor terms) between the call to connect and senddata. When you reached
senddata, the underlying socket had a chance to connect. However if run full
throttle the underlying socket is not yet connected. You might wan't to add
this before the call to send data:

' wait for connection
While winsock.state < sckConnected
Wend

Hope this helps.

"Fung" wrote:

Hello

I use the following codes to pass a socket message to another server.
It works in the debug mode when I execute it step by step using F8.
However, it returns error when I execute it by pressing F5 or by clicking CommandButton1.
The error is: [40006] Wrong protocol or connection state for the requested transaction or request.
Any idea about this?

Private WinSock As Object
Private Sub CommandButton1_Click()
Set WinSock = New MSWinsockLib.WinSock

With Winsock
.Protocol = sckTCPProtocol
.RemoteHost = "server1-2000"
.RemotePort = 690
.Connect
End With

Winsock.SendData strMessage
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mswinsck.ocx Amedee Van Gasse[_3_] Excel Programming 0 July 27th 04 07:29 AM


All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"