I want to read from stdin and a socket, but it is tedious and urgly to do so like 
(while 1 (if (peek 0) ....) (if (net-peek socket) ...) (sleep 10))
I think there is an select function in linux, man 2 select. is there way to do that in newlisp ?
			
			
									
									
						is net-select support file descriptor like stdin ?
You can use 'peek' on sockets as well, and then process channels in a loop:
'channels' is a list of numbers including 0 for stdin
			
			
									
									
						Code: Select all
(while listening
  (dolist (ch channels) 
      (if-not (zero? (peek ch)) 
          (process ch))
  )
)
Actually it should, I just never have tried it. The underlying code uses plain UNIX select(), so 'net-select' should work for any file descriptors.
Vice versa on Unix you could use newLISP file functions (read-line, read/write-buffer etc.) on sockets, and I have tried this successfully. On Windows sockets and file descriptors are not identical and cannot always be used in an interchangeable way.
In newLISP all net-functions also set/reset 'net-error', which would not happend when using normal file functions.
			
			
									
									
						Vice versa on Unix you could use newLISP file functions (read-line, read/write-buffer etc.) on sockets, and I have tried this successfully. On Windows sockets and file descriptors are not identical and cannot always be used in an interchangeable way.
In newLISP all net-functions also set/reset 'net-error', which would not happend when using normal file functions.