I have a list related to multi-client chat problem. This is the list ['talk', client_n, message]. How can I send the "client_n" message from the server in twisted python using transport.write ()?
I wrote the code in two ways. But both of them do not work.
First way:
data = data.strip() dat1 = data.split() dat2 = ' '.join(dat1) l = dat2[5:12] m = dat2[13:] l.transport.write(m)
The second way:
data = data.strip() dat1 = data.split() l1 = dat1[1] m1 = dat1[2] if l1 in self.factory.clients: l1.transport.write(m1)
But in both cases, I got an attribute error.
exceptions.AttributeError: 'str' object has no attribute 'transport'
Can someone please give me a solution for this, please?
source share