Having trouble setting up an extremely simple server...

Roy Smith roy at panix.com
Thu Nov 21 21:50:13 EST 2013


In article <ac9aae1d-b86c-4ea0-b41f-a044e053a932 at googlegroups.com>,
 Cilantro MC <cilantromc at gmail.com> wrote:

> > First thing, get rid of all those semicolons.  This is Python you're 
> > 
> > writing, not C++.  Likewise, the extra parens in your while statements.
> > 
> > 
> > 
> > Your problem is that you're doing the accept() inside your main loop on 
> > 
> > the server.  You want to be doing it once, outside the loop.

I suggest you find another way to post other than Google Groups.  As you 
can see from what I've quoted above, their interface ends up 
double-spacing everything and making it difficult to read.


> I prefer using the semicolons... They aren't making my code wrong... I use 
> other programming languages from time to time, and I'd rather just always use 
> semicolons, as with the parentheses.

Well, no, they're not making your code wrong, but it's just not the way 
people write Python.

>What about sending information back to the client?

You can use the same socket for communication in both directions.  The 
client and server need to alternate doing send() and recv() calls.  
Client does send() and server does recv().  Then, the server does send() 
and the client does recv().



More information about the Python-list mailing list