Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!ycy From: ycy@walt.cc.utexas.edu (Joseph Yip) Newsgroups: comp.unix.questions Subject: non-blocking sockets Message-ID: <28080@ut-emx.UUCP> Date: 12 Apr 90 06:18:48 GMT Sender: news@ut-emx.UUCP Reply-To: ycy@walt.cc.utexas.edu (Joseph Yip) Distribution: usa Organization: The University of Texas at Austin, Austin, Texas Lines: 30 I am writing some socket programs. Everything works fine except when I want my socket to be NON-BLOCKING. I use, /* to read a connected socket */ read(socket_id,buf,BUFS); Does anyone know how to read from a socket using non-blocking mode? recv() system call has a flag that you can PEEK at the socket. Do I have to go through fcntl() call to make it non-blocking? Another question is that if I am transferring 512*512 image file using socket, /* send 512*512 image file */ write(socket_id,buf,512*512); ...... ------------------------------------ /* at the receiving end */ read(socket_id,buf,512*512); Will the receiving end receive all 512*512 bytes before returning? What is the optimal size to send using socket? Thank you Joseph Yip