julia lang - Check if data on a tcpsocket -


how can check if there data on base.tcpsocket, without blocking until there data.

something select both values of timeout-struct set 0.

thanks sbromberger pointed me towards nb_available on paper want.

returns number of bytes available reading before read stream or buffer block.

sadly not useful. example:

enter image description here

on left side should 8 bytes not 0.

to follow on @tasos-papastylianou's linked solution, appears @async eof(c) on server cause nb_available update. note provide correct value @ point in time, , subsequent writes not update nb_available without read. here's example (assumes connection has been established already):

client> write(c, 12.5)  server> nb_available(c) 0  server> @async eof(c) task (done) @0x0000000123b7f850  server> nb_available(c) 8  client> write(c, 12.5)  client> write(c, 22.5)  server> nb_available(c) 8  server> @async eof(c) task (done) @0x0000000123b7c010  server> nb_available(c) 8  server> read(c,8) 8-element array{uint8,1}:  0x00  0x00  0x00  0x00  0x00  0x80  0x36  0x40  server> nb_available(c) 0  server> @async eof(c) task (done) @0x0000000123b7c010  server> nb_available(c) 16 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -