# Runtime error 40006 with Winsock in VB6



## snow_81us (Jul 11, 2004)

Hello all

I am just learning how to use Winsock in VB6. So I made a small chat program. The problem that I have is as follows
I ran the program on my machine and I did not have any problems, but when I tried to run it on a remote machine I ended up getting a Runtime error:40006 Wrong protocol.
I looked at what microsoft had to say about this problem and I found that this error mostly occurs when the server/client tried to send data without a connection being established. So I included the following event

```
Private Sub winsock_connect()
cmdSend.Enabled = True
MsgBox "The client is connected"
End Sub
```
Then I ended up with another problem. When I ran the program on my machine, the client connected to the server and I was able to send data to the server, but the send button never became active since the above event did not occur.
Some one correct me if I am wrong but the client will send data to the server only if it is connected right? 
In that case the above event must occur! But for some reason it does not occur any one have any idea as to why this happens.

Any help would be greatly appreciated
Thanks


----------

