On 26/10/2013 22:41, theelder...@gmail.com wrote:
Hello all, I am kind of new to python. 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']

This is a list of Python strings, not an array, not sockets.


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 <module>
     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. Thank you.


See this http://docs.python.org/3/library/socket.html#example

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to