Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3F974B1C.1BE6253A@dessent.net> Date: Wed, 22 Oct 2003 20:29:32 -0700 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,en-US MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: select() doesn't respond References: <20031023025857 DOT 932 DOT qmail AT web303 DOT mail DOT yahoo DOT co DOT jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.linuxsv3.net X-AntiAbuse: Original Domain - cygwin.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dessent.net Note-from-DJ: This may be spam Takeshi Honda wrote: > if ((sock=socket(AF_INET,SOCK_RAW,IPPROTO_TCP))==-1){ > printf("Can not create RAW socket.\n"); > return -1; > } > > FD_ZERO(&read_fd); > FD_SET(sock,&read_fd); > select(FD_SETSIZE,&read_fd,NULL,NULL,NULL); // program > stop here You create a socket but you don't call bind(), connect(), or listen() on it so I don't know what you expect to happen. AFAIK just creating a socket and then trying to read from it is an undefined behavior, but I could be wrong. If you're trying to read raw packets off the interface you're going to need to use libpcap. Fortunately, there is a libpcap library for Windows (called WinPcap), and there are cygwin bindings for it so it can be used in the same way as with linux. There are a handful of examples that come with the library code, so you should probably start there. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/