I have a problem getting this to work. Server only recieves half of the data being sent. Whats wrong

Dependencies:   mbed

Committer:
tax
Date:
Tue Mar 29 13:20:15 2011 +0000
Revision:
0:66300c77c6e9

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tax 0:66300c77c6e9 1 /**
tax 0:66300c77c6e9 2 * @file
tax 0:66300c77c6e9 3 * Common functions used throughout the stack.
tax 0:66300c77c6e9 4 *
tax 0:66300c77c6e9 5 */
tax 0:66300c77c6e9 6
tax 0:66300c77c6e9 7 /*
tax 0:66300c77c6e9 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
tax 0:66300c77c6e9 9 * All rights reserved.
tax 0:66300c77c6e9 10 *
tax 0:66300c77c6e9 11 * Redistribution and use in source and binary forms, with or without modification,
tax 0:66300c77c6e9 12 * are permitted provided that the following conditions are met:
tax 0:66300c77c6e9 13 *
tax 0:66300c77c6e9 14 * 1. Redistributions of source code must retain the above copyright notice,
tax 0:66300c77c6e9 15 * this list of conditions and the following disclaimer.
tax 0:66300c77c6e9 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
tax 0:66300c77c6e9 17 * this list of conditions and the following disclaimer in the documentation
tax 0:66300c77c6e9 18 * and/or other materials provided with the distribution.
tax 0:66300c77c6e9 19 * 3. The name of the author may not be used to endorse or promote products
tax 0:66300c77c6e9 20 * derived from this software without specific prior written permission.
tax 0:66300c77c6e9 21 *
tax 0:66300c77c6e9 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
tax 0:66300c77c6e9 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
tax 0:66300c77c6e9 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
tax 0:66300c77c6e9 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
tax 0:66300c77c6e9 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
tax 0:66300c77c6e9 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
tax 0:66300c77c6e9 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
tax 0:66300c77c6e9 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
tax 0:66300c77c6e9 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
tax 0:66300c77c6e9 31 * OF SUCH DAMAGE.
tax 0:66300c77c6e9 32 *
tax 0:66300c77c6e9 33 * This file is part of the lwIP TCP/IP stack.
tax 0:66300c77c6e9 34 *
tax 0:66300c77c6e9 35 * Author: Simon Goldschmidt
tax 0:66300c77c6e9 36 *
tax 0:66300c77c6e9 37 */
tax 0:66300c77c6e9 38
tax 0:66300c77c6e9 39 #include "lwip/opt.h"
tax 0:66300c77c6e9 40 #include "lwip/def.h"
tax 0:66300c77c6e9 41
tax 0:66300c77c6e9 42 /**
tax 0:66300c77c6e9 43 * These are reference implementations of the byte swapping functions.
tax 0:66300c77c6e9 44 * Again with the aim of being simple, correct and fully portable.
tax 0:66300c77c6e9 45 * Byte swapping is the second thing you would want to optimize. You will
tax 0:66300c77c6e9 46 * need to port it to your architecture and in your cc.h:
tax 0:66300c77c6e9 47 *
tax 0:66300c77c6e9 48 * #define LWIP_PLATFORM_BYTESWAP 1
tax 0:66300c77c6e9 49 * #define LWIP_PLATFORM_HTONS(x) <your_htons>
tax 0:66300c77c6e9 50 * #define LWIP_PLATFORM_HTONL(x) <your_htonl>
tax 0:66300c77c6e9 51 *
tax 0:66300c77c6e9 52 * Note ntohs() and ntohl() are merely references to the htonx counterparts.
tax 0:66300c77c6e9 53 */
tax 0:66300c77c6e9 54
tax 0:66300c77c6e9 55 #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
tax 0:66300c77c6e9 56
tax 0:66300c77c6e9 57 /**
tax 0:66300c77c6e9 58 * Convert an u16_t from host- to network byte order.
tax 0:66300c77c6e9 59 *
tax 0:66300c77c6e9 60 * @param n u16_t in host byte order
tax 0:66300c77c6e9 61 * @return n in network byte order
tax 0:66300c77c6e9 62 */
tax 0:66300c77c6e9 63 u16_t
tax 0:66300c77c6e9 64 lwip_htons(u16_t n)
tax 0:66300c77c6e9 65 {
tax 0:66300c77c6e9 66 return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
tax 0:66300c77c6e9 67 }
tax 0:66300c77c6e9 68
tax 0:66300c77c6e9 69 /**
tax 0:66300c77c6e9 70 * Convert an u16_t from network- to host byte order.
tax 0:66300c77c6e9 71 *
tax 0:66300c77c6e9 72 * @param n u16_t in network byte order
tax 0:66300c77c6e9 73 * @return n in host byte order
tax 0:66300c77c6e9 74 */
tax 0:66300c77c6e9 75 u16_t
tax 0:66300c77c6e9 76 lwip_ntohs(u16_t n)
tax 0:66300c77c6e9 77 {
tax 0:66300c77c6e9 78 return lwip_htons(n);
tax 0:66300c77c6e9 79 }
tax 0:66300c77c6e9 80
tax 0:66300c77c6e9 81 /**
tax 0:66300c77c6e9 82 * Convert an u32_t from host- to network byte order.
tax 0:66300c77c6e9 83 *
tax 0:66300c77c6e9 84 * @param n u32_t in host byte order
tax 0:66300c77c6e9 85 * @return n in network byte order
tax 0:66300c77c6e9 86 */
tax 0:66300c77c6e9 87 u32_t
tax 0:66300c77c6e9 88 lwip_htonl(u32_t n)
tax 0:66300c77c6e9 89 {
tax 0:66300c77c6e9 90 return ((n & 0xff) << 24) |
tax 0:66300c77c6e9 91 ((n & 0xff00) << 8) |
tax 0:66300c77c6e9 92 ((n & 0xff0000UL) >> 8) |
tax 0:66300c77c6e9 93 ((n & 0xff000000UL) >> 24);
tax 0:66300c77c6e9 94 }
tax 0:66300c77c6e9 95
tax 0:66300c77c6e9 96 /**
tax 0:66300c77c6e9 97 * Convert an u32_t from network- to host byte order.
tax 0:66300c77c6e9 98 *
tax 0:66300c77c6e9 99 * @param n u32_t in network byte order
tax 0:66300c77c6e9 100 * @return n in host byte order
tax 0:66300c77c6e9 101 */
tax 0:66300c77c6e9 102 u32_t
tax 0:66300c77c6e9 103 lwip_ntohl(u32_t n)
tax 0:66300c77c6e9 104 {
tax 0:66300c77c6e9 105 return lwip_htonl(n);
tax 0:66300c77c6e9 106 }
tax 0:66300c77c6e9 107
tax 0:66300c77c6e9 108 #endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */