Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Question about UNIX select()

Name: Anonymous 2010-03-25 13:56

I know that select() tells you if a file descriptor is ready for reading or writing without blocking, but how do you know how many bytes can be sent before it must be blocked? Is there some minimum in a header that I can rely on?

Name: Anonymous 2010-03-25 13:56

No.

Name: Anonymous 2010-03-25 14:02

>>2
Then is there some number which, in practice, almost never requires blocking? Maybe a page size...?

Name: Anonymous 2010-03-25 14:04

>>3
not really. there might be one on HDDs, but sockets and friends are arbitrary.

Name: Anonymous 2010-03-25 14:08

1

Name: Anonymous 2010-03-25 14:08

>>4
Well, thanks anyway, but it's not that important. It's just some homework I've already done, but it felt wrong to read and write only one byte at a time, so I wanted to optimize it. (The program is a simple server that writes whatever it receives to each connected client, and the clients send each typed character to the server and write any responses to the terminal.)

Name: Anonymous 2010-03-25 14:11

>>6
you might just as well used netcat

Name: Anonymous 2010-03-25 14:32

>>7
Actually, netcat doesn't work with named sockets, which is what the assignment specified to use. But you're right that the client program is basically just a non-generic, shittier version of netcat.

Name: Anonymous 2010-03-25 15:28

>>8
And netcat is just a non-generic, shittier version of socat.

>>6,1
If you don't want to block, why are you using blocking file descriptors?

Name: Anonymous 2010-03-25 15:41

>>9
Because the assignment mandates it. We're supposed to avoid blocking by using select(), and we must open the file descriptors as blocking (which is the default, anyways.)

Name: Anonymous 2010-12-25 20:19

Name: Anonymous 2011-02-03 6:19

Don't change these.
Name: Email:
Entire Thread Thread List