On Fri, 13 Jun 2008 21:59:06 +0530, srinivasan srinivas wrote: > Hi, > I am going to do some socket related programming in Python. Before that, > I wish to know the Gotchas of Python Scoket Programming. Can anyone send > me any link that satisfies my needs?? Thanks, > Srini > > > Explore your hobbies and interests. Go to > http://in.promos.yahoo.com/groups/
IMO, there aren't many. Some methods require a tuple where you might think they shouldn't need one. And you have to be careful not to make assumptions about, say, writing n bytes in your server and reading n bytes in the client - you may not get all n right away. TCP is free to split or aggregate your chunks as it sees fit. So you need some sort of record terminator or something, rather than assuming transfer sizes will be preserved by TCP. Often they will be preserved, but they aren't guaranteed to be. But this is true of just about any language with a socket interface. For the latter issue (the chunk size thing), I put together http:// stromberg.dnsalias.org/~strombrg/bufsock.html -- http://mail.python.org/mailman/listinfo/python-list