Results 1 to 7 of 7

Thread: Winsock - Connection is forcefully rejected (10061)

Threaded View

  1. #1

    Thread Starter
    Addicted Member beic's Avatar
    Join Date
    Jun 2012
    Posts
    176

    Question Winsock - Connection is forcefully rejected (10061)

    Hi there,

    I made a simple remote Server / Client application and it's working fine, but the Client wont reconnect at the second time, it will only work if I exit the Server and rerun it.

    I'm getting error on second reconnect attempt "10061 - Connection is forcefully rejected".

    Server code:
    Code:
    Private Sub Form_Load()
    
     With wskServer
      .Protocol = sckTCPProtocol
      .RemotePort = 0
      .LocalPort = 51393
      .Listen
     End With
     
     Debug.Print "TCP Server started..."
     Debug.Print "- Host: " & wskServer.LocalHostName
     Debug.Print "- IP: " & wskServer.LocalIP
     Debug.Print "- Port: " & wskServer.LocalPort
     Debug.Print "============================="
     
     Exit Sub
    
    Private Sub wskServer_ConnectionRequest(ByVal requestID As Long)
        
     If wskServer.State <> sckClosed Then wskServer.Close
     
     wskServer.Accept requestID
    
     Debug.Print "Client connected from IP: " & wskServer.RemoteHostIP & ", Port: " & wskServer.RemotePort
     
    End Sub
    
    Private Sub wskServer_Close()
     
     Debug.Print "Client disconnected from IP: " & wskServer.RemoteHostIP & ", Port: " & wskServer.RemotePort
     
    End Sub
    
    Private Sub wskServer_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
     
     MsgBox "Error " & Number & ": " & Description
     
    End Sub
    I really don't know where would be the issue.

    Any guidance is highly appreciated!
    Last edited by beic; Mar 18th, 2024 at 06:33 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width