Winsock array not accepting multiple connections 
Author Message
 Winsock array not accepting multiple connections

Hello,
  I'm working on a project, and I'm having a slight problem. Using VB5
(SP3) and Microsofts Winsock control.

I use an array of WInsock controls, loaded at runtime
The client(s) all connect to the same port, so I use Winsock(0) to Listen,
and pass incoming connections to a new control.

Winsock_ConnectionRequest(Index as integer, RequestID as long)
' I load a new Winsock() and pass the requestID to it
    If Winsock(Index).State <> sckClosed Then Winsock(Index).Close
    If Index = 0 Then
        Load Winsock(CurrentUsers + 1)
        Winsock(CurrentUsers + 1).LocalPort = 0
        Call Winsock_ConnectionRequest(CInt(CurrentUsers + 1), requestID)
        Winsock(0).Close
        Winsock(0).Listen
    End If
    If Index <> 0 Then
        CurrentUsers = CurrentUsers + 1
        Winsock(Index).Accept (requestID)
    End If
End Sub

The problem is that when I try to connect via a second server (using
127.0.0.1 for testing), I get the error #40006, " Wrong protocol or
connection state for the requested transaction or request ".  This occurs
in the Winsock_SendData Event.  Prior to this, it seems to connect fine,
according to it's State.

I have heard of problems with this Winsock control. Is there some
workaround for this?

Thanks,

Adam Israel

(Please CC any replies)



Sat, 17 Jun 2000 03:00:00 GMT  
 Winsock array not accepting multiple connections

Quote:

> I have heard of problems with this Winsock control. Is there some
> workaround for this?

I'm not sure what your situation is but if you ever have winsock
problems when compiled but not in the VB IDE, compile to p-code rather
than native.  This solved multiple problems for me that existed on some
machines and not others.  If you're going to release this software to
run on multiple machines out there, I suggest you use p-code even if
native works on your development machine.  If your problem exists in the
IDE, this probably won't help.

good luck.

--
=======================================================================
Murray Macdonald                                      http://www.mha.ca
Macdonald Harris and Associates - Vancouver, Canada    Ph. 604.608.0218
Software Development, Web Programming, Database Design, Authoring Tools
=======================================================================



Sun, 25 Jun 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Winsock control not accepting multiple connections with Array

2. Winsock control not accepting multiple connections with Array

3. Winsock control not accepting multiple connections

4. Multiple Winsock-Connections to a server AND Winsock-Connection to a server minimized in systray

5. Winsock.dll Accepting a connection

6. accept multiple connection

7. How to accept multiple Socket connections?

8. cant get winsock to accept connection!!!

9. visual basic winsock control and multiple client connections

10. Winsock multiple connections

11. Winsock, multiple connections

12. Telnet Server Source or Multiple Winsock Connections?

 

 
Powered by phpBB® Forum Software