Code not working with new version
jimmie11 opened this issue · 1 comments
jimmie11 commented
I was using the code below in an older version.
Now, I am getting a compile error:
"Error BC30451 'connClient' is not declared. It may be inaccessible due to its protection level."
What is the error? It used to work before.
Here is the code;
Private Sub send2Controller()
Try
If (Started) Then
'----------------------------------------------------------------------------
Dim clients As IEnumerable(Of String) = _Server.ListClients()
clients = _Server.ListClients.ToList
For Each connClient In clients
If Not String.IsNullOrEmpty(connClient) Then
_Server.Send(connClient, bFullMessage)
lastSendTime = Now
Logger(Severity.Debug, "ID: " + CStr(truckID) + " - Sent " + (CStr(bFullMessage.Length)) + " bytes to client " & connClient & " - " + "at " + Now.ToString)
Else
Logger(Severity.Debug, "No client connected")
End If
Next
'----------------------------------------------------------------------------
If (textNetwork.Text.Length > 100000) Then Set_textNetworkBoxOutText("")
'----------------------------------------------------------------------------
End If
Catch ex As Exception
writeIssuesFile("Send ERROR: " + ", ID = " + CStr(truckID) + " Msg: " + ex.Message)
End Try
End Sub
jchristn commented
I'm assuming you were using 4.x. In 5.x the ListClients
changed from providing an IEnumerable<string>
to an IEnumerable<ClientMetadata>
, and, the Send
(and variant) methods no longer accept a string ipPort
but require Guid guid
. The ClientMetadata
object has a Guid
property. So your iteration will need to be modified.