I am currently trying to make and use a list/array of sockets in a program. So I have declared an array as follows:
myCSocks = ['CSock1', 'CSock2', 'CSock3', 'CSock4', 'CSock5']
and I am trying to use my array elements as follows:
myCSocks[i], addr = serverSocket.accept()
and
message = myCSocks[i].recv(1024)
I am getting the following error:
Traceback (most recent call last):
File "./htmlserv_multi.py", line 22, in
message = myCSocks[i].recv(1024)
AttributeError: 'str' object has no attribute 'recv'
This kind of makes sense to me, it is saying that my array elements are of type String and are not sockets. So I understand what my problem is but I do not know how to remedy it. I have googled "list of sockets python" but did not find anything. Any help will be greatly appreciated.