Laszlo Nagy wrote:
[...]
I have read the socket programming howto (
http://docs.python.org/howto/sockets.html#sockets ) but it does not
explain how a blocking socket + select is different from a non blocking
socket + select. Is there any difference?
There is, but it may not effect you. There
Bryan Olson fakeaddr...@nowhere.org wrote:
Where does this come up? Suppose that to take advantage of multi-core
processors, our server runs as four processes, each with a single thread
that responds to events via select(). Clients all connect to the same
server port, so the socket listening
Bryan Olson fakeaddr...@nowhere.org wrote:
There are cases where a socket can select() as readable, but not be
readable by the time of a following recv() or accept() call. All such
cases with which I'm familiar call for a non-blocking socket.
I used to believe that if select() said data was
Can you post an example program that exhibits the behavior you
describe?
I was forgetting about the MSG_WAITALL flag ...
When I started programming with sockets, it was on a platform (IIRC
Solaris) that by default behaved like MSG_WAITALL was set by default
(actually, I don't remember it
Grant Edwards ha scritto:
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in the
recv (again, assuming that you use TCP as protocol, that is
Jean-Paul Calderone ha scritto:
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio
bock...@virgilio.it wrote:
[snip]
If you are interested in socket errors, you should
also fill the third 'fd-set' in the select call, and after select
returns check that fd is not in it anymore:
ready =
Francesco Bochicchio ha scritto:
No, in blocking mode it will wait to receive _some_ data (1 or
more bytes). The requested amount is strictly an upper
limit: recv won't return more than the requested number of
bytes, but it might return less.
Uhm. In my experience, with TCP protocol recv
On Dec 31, 2:01 pm, Francesco Bochicchio bock...@virgilio.it wrote:
Grant Edwards ha scritto:
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference
...
Uhm. In my experience, with TCP protocol recv only returned less than
the required bytes if the remote end disconnects. I always check the
What if the sending end actually sent less than you asked for ?
-srp
In blocking mode and with TCP protocol, the recv waits until more bytes
On Dec 31, 7:48 pm, Francesco Bochicchio bock...@virgilio.it wrote:
...
Uhm. In my experience, with TCP protocol recv only returned less than
the required bytes if the remote end disconnects. I always check the
What if the sending end actually sent less than you asked for ?
-srp
In
On Wed, Dec 31, 2008 at 5:39 AM, Francesco Bochicchio
bock...@virgilio.itwrote:
Francesco Bochicchio ha scritto:
No, in blocking mode it will wait to receive _some_ data (1 or
more bytes). The requested amount is strictly an upper
limit: recv won't return more than the requested number of
On Wed, 31 Dec 2008 15:48:50 +0100, Francesco Bochicchio bock...@virgilio.it
wrote:
...
Uhm. In my experience, with TCP protocol recv only returned less than
the required bytes if the remote end disconnects. I always check the
What if the sending end actually sent less than you asked for ?
On 2008-12-31, Francesco Bochicchio bock...@virgilio.it wrote:
Grant Edwards ha scritto:
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in
Jean-Paul Calderone wrote:
...
On a LAN, it's likely that you'll generally get the exact number of bytes
which the sender passed to one call of send (until the sender starts to
pass really huge strings to send, then it'll get split up) just because
the network has lots of capacity compared to
Saju Pillai ha scritto:
On Dec 31, 7:48 pm, Francesco Bochicchio bock...@virgilio.it wrote:
Is this correct ? IIRC even in blocking mode recv() can return with
less bytes than requested, unless the MSG_WAITALL flag is supplied.
Blocking mode only guarantees that recv() will wait for a message
Francesco Bochicchio b...@virgilio.it wrote:
but then, IIRC TCP guarantees that the packet is fully received by
hand-shaking at transport level between sender and receiver. Ad once the
packet is fully in the receiver buffer, why should recv choose to give
back to the application only a
I'm using this method to read from a socket:
def read_data(self,size):
Read data from connection until a given size.
res =
fd = self.socket.fileno()
while not self.stop_requested.isSet():
remaining = size - len(res)
if remaining=0:
Laszlo Nagy wrote:
I'm using this method to read from a socket:
def read_data(self,size):
Read data from connection until a given size.
res =
fd = self.socket.fileno()
while not self.stop_requested.isSet():
remaining = size - len(res)
Laszlo Nagy ha scritto:
I'm using this method to read from a socket:
def read_data(self,size):
Read data from connection until a given size.
res =
fd = self.socket.fileno()
while not self.stop_requested.isSet():
remaining = size - len(res)
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio bock...@virgilio.it
wrote:
[snip]
If you are interested in socket errors, you should
also fill the third 'fd-set' in the select call, and after select returns
check that fd is not in it anymore:
ready = select.select( [fd],[], [fd] )
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in the
recv (again, assuming that you use TCP as protocol, that is AF_INET,
SOCK_STREAM),
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards gra...@visi.com wrote:
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in the
recv (again,
On Tue, 30 Dec 2008 15:55:51 -0500, Jean-Paul Calderone exar...@divmod.com
wrote:
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards gra...@visi.com wrote:
On 2008-12-30, Francesco Bochicchio bock...@virgilio.it wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
23 matches
Mail list logo