array/list of sockets

2013-10-26 Thread theelder777
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']

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

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


Re: array/list of sockets

2013-10-26 Thread theelder777
Thank you for your quick replies. I am trying to implement a very simple 
multithreaded webserver in python. Is using an array of sockets (for different 
clients) the correct way to go?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: array/list of sockets

2013-10-26 Thread theelder777
Thank you all for your time and great replies. I think/hope I have enough info 
to able to implement this simple server.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: array/list of sockets

2013-10-26 Thread theelder777

I apologize but I do not understand what you mean by "lack of context." I have 
taken Chris' words into consideration, for my previous post was supposed to be 
my last (I just had to say thank you). This is my first google groups post, so 
I am a total noob. Once again, I apologize for whatever that I may have done. I 
will not post in google groups again : ) 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: array/list of sockets

2013-10-26 Thread theelder777
On Saturday, October 26, 2013 4:36:04 PM UTC-7, Mark Lawrence wrote:

> That's okay, everybody has to start somewhere :)
> 
> 
> 
> A definition from http://www.thefreedictionary.com/context "The part of 
> 
> a text or statement that surrounds a particular word or passage and 
> 
> determines its meaning".  So lack of context means the surrounding part 
> 
> is missing, which applies to your words above as nobody knows at a 
> 
> glance to whom or to what you're replying.  Clear I hope?
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

Yes, crystal clear. Thank you. Since I am writing this post, I have one final 
question. I got my code to work for a multithreaded web server, how do I test 
if it can handle multiple threads? 

Also as a side note, I have subscribed to the python mailing list but have no 
idea how to use it. Thank you everyone for being patient.
-- 
https://mail.python.org/mailman/listinfo/python-list