Flush.c revision 7a3b38f7
1/* 2 * $Xorg: Flush.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ 3 * 4 * 5Copyright 1989, 1998 The Open Group 6 7Permission to use, copy, modify, distribute, and sell this software and its 8documentation for any purpose is hereby granted without fee, provided that 9the above copyright notice appear in all copies and that both that 10copyright notice and this permission notice appear in supporting 11documentation. 12 13The above copyright notice and this permission notice shall be included in 14all copies or substantial portions of the Software. 15 16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 23Except as contained in this notice, the name of The Open Group shall not be 24used in advertising or otherwise to promote the sale, use or other dealings 25in this Software without prior written authorization from The Open Group. 26 * * 27 * Author: Keith Packard, MIT X Consortium 28 */ 29 30/* $XFree86: xc/lib/Xdmcp/Flush.c,v 3.7 2001/07/23 13:15:42 dawes Exp $ */ 31 32#ifdef WIN32 33#define _WILLWINSOCK_ 34#endif 35#ifdef HAVE_CONFIG_H 36#include <config.h> 37#endif 38#include <X11/Xos.h> 39#include <X11/X.h> 40#include <X11/Xmd.h> 41#include <X11/Xdmcp.h> 42 43#ifdef STREAMSCONN 44#include <tiuser.h> 45#else 46#ifdef WIN32 47#include <X11/Xwinsock.h> 48#else 49#ifndef Lynx 50#include <sys/socket.h> 51#else 52#include <socket.h> 53#endif /* !Lynx */ 54#endif 55#endif 56 57int 58XdmcpFlush (int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen) 59{ 60 int result; 61#ifdef STREAMSCONN 62 struct t_unitdata dataunit; 63 64 dataunit.addr.buf = to; 65 dataunit.addr.len = tolen; 66 dataunit.opt.len = 0; /* default options */ 67 dataunit.udata.buf = (char *)buffer->data; 68 dataunit.udata.len = buffer->pointer; 69 result = t_sndudata(fd, &dataunit); 70 if (result < 0) 71 return FALSE; 72#else 73 result = sendto (fd, (char *)buffer->data, buffer->pointer, 0, 74 (struct sockaddr *)to, tolen); 75 if (result != buffer->pointer) 76 return FALSE; 77#endif 78 return TRUE; 79} 80