I am currently trying to set up a server winsock but the problem is even after certain clients have disconnected from the server, the server trys to send data to those disconnected clients causing either a server side runtime error or preventing further clients to connect(or the same client to reconnect).
I tried to fix this by using a for i and running an if statement excluding any clients that are not ready to receive (disconnected, unavailable...) and further I tried to make it Disconnect these using and Else statement on if (listed below)
For i = 1 To iSockets
If Socket(i).State = 7 Then
Socket(i).senddata senddata
Else
Socket(i).Close
End If
Next i
"Socket" is the name for winsock in this instance
"senddata" is a string that has been previously set to be transfered
"iSockets" is a integer that increases by 1 every time another user connects
Am I missing something completely, please help. (I tried without
Else
Socket(i).Close
just letting it bypass and ignore any socket index that is not in state 7 ... this allowed it to run without any errors but once a computer connects and disconnects from the server they can not reconnect.)
Thanks in advance to anyone who tries to help. (it has been quite awhile since I have done VB I just started again a few days ago)