Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21089

[RESOLVED] winsock close connection client server

$
0
0
its all in 1 project

formload event
Code:

Winsock2(0).Close
          Winsock2(0).LocalPort = 8514
            Winsock2(0).Listen

Code:

Winsock1.Close
            Winsock1.RemotePort = 8514
            Winsock1.RemoteHost = txtRemoteIP.Text
            Winsock1.Connect
            End If

Code:

Private Sub Winsock1_Connect()
Winsock1.SendData "100" & "tommy"
End Sub



Code:

Private Sub Winsock2_Close(Index As Integer)
    Winsock2(Index).Close
End Sub

Private Sub Winsock2_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    On Error Resume Next
    If MsgBox("This User Wishes To Se Your Cam " & vbCrLf & " request ID : " & requestID, vbInformation + vbYesNo, Me.Caption) = vbNo Then Exit Sub
  ' DisTxt.Text = DisTxt.Text & "Connection Request from : " & _
        Winsock2(Index).RemoteHostIP
    NumSockets = NumSockets + 1
    '//Increase Number of Sockets by one.
    Load Winsock2(NumSockets)
    '//Load a New Winsock Object Nusockets as Index Value
    Winsock2(NumSockets).Accept requestID
    '//Accept the New Connection
 Winsock2(NumSockets).SendData "Connection Complete."
End Sub


then list1 adds = ( tommy ) username
now by clicking on tommy username how do i close his connection


when i did was compiled 1 project with formload event containing winsock2 listen
then ran that as server.

then i ran ide removing the formload event and tried to connect to that compiled project i can connect successfull
but not able to send disconnect message out from server ? i get (wrong protocol message )

Viewing all articles
Browse latest Browse all 21089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>