I have a server socket which spins off a bunch of easytcp sockets. However, I want to send a message to all the connected ports outside of the tcpobject itself. So in my app I need to enumerate all the easytcp sockets and send a message. Is this actually possible?
Does ServerSocket.ActiveConnections work for what you want?
ActiveConnections has to contain TCPSockets because that is the base class; The method cannot change its return type based on what type of socket you might be using. Perhaps you can cast the sockets it returns? I’m thinking of something like this:
[code]
Dim activeSockets() As TCPSocket ’ Active sockets
Dim ms() As EasyTCPSocket ’ actual sockets
activeSockets = App.MySocket.ActiveConnections
For Each tcp As TCPSocket In activeSockets
ms.Append(EasyTCPSocket(tcp)) ’ might work
Next
For Each es As EasyTCPSocket In ms
es.SendMessage(1, “Send data”)
Next[/code]
Dim activeSockets() As TCPSocket ' Active sockets
activeSockets = App.MySocket.ActiveConnections
For Each tcp As TCPSocket In activeSockets
if tcp Isa EasyTCP then
EasyTCPSocket(tcp).write whatever message I want ........
end if
Next