Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com> List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com> List-Archive: <http://sourceware.cygnus.com/ml/cygwin/> List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com> List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs> Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <37C4633C.F64DC8D4@mail.com> Date: Wed, 25 Aug 1999 17:42:20 -0400 From: "Robert A. Mackie" <robert_mackie AT mail DOT com> X-Mailer: Mozilla 4.51 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: Mumit Khan <khan AT xraylith DOT wisc DOT EDU> CC: cygwin AT sourceware DOT cygnus DOT com Subject: Re: posix style DGRAM sockets with cygwin.dll References: <199908250127 DOT UAA28632 AT mercury DOT xraylith DOT wisc DOT edu> Content-Type: multipart/mixed; boundary="------------10756DF90449875F2DA2F74D" --------------10756DF90449875F2DA2F74D Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mumit, Thank you for looking. I'm sorry this I asked for your time on what turned out to be a code inspection issue rather than a cygwin issue. Since the unix system on which it ran correctly uses network order for memory, the code worked there, inspite of my error. I should have been more vigilent. Rob. PS: I'm very impressed with the value of cygwin. I should free up from my most urgent deadlines in the next month or so. I plan to volunteer some effort to help support cygwin at that point. What a convenient set of tools and library. Mumit Khan wrote: > "Robert A. Mackie" <robert_mackie AT mail DOT com> writes: > > > > I'm trying to get a very simple UDP example ported to cygwin as a > > starting point for some real code I expect to develop. Everything > > compiles and links, but the sockets don't communicate. When built for > > unix the same code works fine. (unless I've introduced some small bug > > trying to get it to work under cygwin.) I notice I'm not the first to > > say something like this. The last person was using the -no-cygwin > > option and was told to call WSAStartup. I read as much documentation as > > I could find. It looked to me like that was not necessary when using > > the posix calls, rather than the winsock calls. (Maybe I'm wrong ?) > > If you're using -mno-cygwin, you're using Windows sockets (and you need > WSAStartup); if you're *not* using -mno-cygwin, you're using POSIX sockets > and obviously don't need the windows hacks, er features. > > > If I do need to initialize winsock explicitly, could you help me with a > > couple of details? The only place that I see WSAStartup and WSACleanup > > defined is in <Windows32/Sockets.h>. This file seems to be set up for > > an MSC compiler, and includes a bunch of other similar headers. When I > > include any of them and the standard headers I'm used to, I get all > > sorts of re-definition collisions between the headers. When I include > > them without the standard headers, things like strerror aren't defined. > > You include winsock.h, not the internal headers, but *only* if you're using > Windows sockets. If you're using Cygwin runtime, use the POSIX specs and > forget about the windows headers (Cygwin runtime will do the right thing). > > It's quite unclear from your message what runtime you're trying to use > and so on. If you could elaborate, we could try to help. > > As far as your code is concerned, there is at least one blatant bug I > see right away -- > > server_address.sin_port = htonl(SERVER_UDP_PORT); > ^^^^^ (should be htons) > > likewise in the other case. Just remember that sin_addr is htonl and > sin_port is htons and life would be a lot easier. > > Perhaps you ought to check over your code a bit more and try again. > > Regards, > Mumit --------------10756DF90449875F2DA2F74D Content-Type: text/x-vcard; charset=us-ascii; name="robert_mackie.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Robert A. Mackie Content-Disposition: attachment; filename="robert_mackie.vcf" begin:vcard n:Mackie;Robert tel;cell:919 601 6307 tel;work:919 405 4564 x-mozilla-html:TRUE adr:;;;;;; version:2.1 email;internet:robert_mackie AT mail DOT com fn:Robert Mackie end:vcard --------------10756DF90449875F2DA2F74D Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com --------------10756DF90449875F2DA2F74D--