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: <4359C50C.76649CA1@dessent.net> Date: Fri, 21 Oct 2005 21:50:20 -0700 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Socket read problem on Windows XP Pro & Cygwin References: <20051022035348.RADA2767.eastrmmtao03.cox.net@[172.18.52.8]> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com trearick_news AT cox DOT net wrote: > I'm assuming I'm doing something wrong here...and I'm just lucky to have it work right on my laptop...can anyone help? Your test case does not compile, because you've omitted the #includes and #defines. I think you will find that posting code that someone can actually compile and run will get you better help than posting fragments. Next time just attach the whole file. Is there anything that differs between your two machines in regard to what's connected to the com port, or the com port settings? Have to tried compiling with -Wall to see if there are any warnings that might indicate you forgot a prototype or used an incorrect parameter? (Standard troubleshooting stuff..) > char *outdev = OUTPUT_DEVICE; What is OUTPUT_DEVICE? You need to use the unix device name ("/dev/ttyS0") and not a DOS/Windows device name ("COM1:"). > outfd = open(outdev,O_RDWR | O_BINARY,S_IREAD | S_IWRITE); If you're doing serial IO then you probably need calls to tcgetattr() and tcsetattr() to do things like disable canonical mode, set the baud rate, data bits, stop bits, flow control, etc. Since the only thing your program is doing is outputting bytes then most of that probably doesn't matter, but for a nontrivial program it might. > len = recv(infd,buf,1,0); You might as well use read() here if you aren't using the flags. > write(outfd,buf,len); It would be good to check the return value of this. 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/