diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-16 18:48:39 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-16 18:48:39 +0000 |
commit | 66fa9eb830939b33a268b24573f9fdf59850dac5 (patch) | |
tree | f520073b0832172588d8021184f8833548e08d5b /nuttx/examples | |
parent | d6100fb0fad57df531e0774793d188e899943852 (diff) | |
download | px4-nuttx-66fa9eb830939b33a268b24573f9fdf59850dac5.tar.gz px4-nuttx-66fa9eb830939b33a268b24573f9fdf59850dac5.tar.bz2 px4-nuttx-66fa9eb830939b33a268b24573f9fdf59850dac5.zip |
Basic server functionality: listen(), accept()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@382 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r-- | nuttx/examples/nettest/Makefile | 11 | ||||
-rw-r--r-- | nuttx/examples/nettest/host.c | 2 | ||||
-rw-r--r-- | nuttx/examples/nettest/nettest-client.c | 6 | ||||
-rw-r--r-- | nuttx/examples/nettest/nettest-server.c | 6 | ||||
-rw-r--r-- | nuttx/examples/nettest/nettest.c | 2 | ||||
-rw-r--r-- | nuttx/examples/nettest/nettest.h | 4 |
6 files changed, 16 insertions, 15 deletions
diff --git a/nuttx/examples/nettest/Makefile b/nuttx/examples/nettest/Makefile index 185b5b669..55cb4d30f 100644 --- a/nuttx/examples/nettest/Makefile +++ b/nuttx/examples/nettest/Makefile @@ -42,7 +42,7 @@ TARG_ASRCS = TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) TARG_CSRCS = nettest.c -ifeq ($(CONFIG_NETTEST_SERVER),y) +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) TARG_CSRCS += nettest-server.c else TARG_CSRCS += nettest-client.c @@ -55,13 +55,14 @@ TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) TARG_BIN = lib$(CONFIG_EXAMPLE)$(LIBEXT) -HOSTCFLAGS += -DCONFIG_NETTEST_HOST=1 -ifeq ($(CONFIG_NETTEST_SERVER),y) -HOSTCFLAGS += -DCONFIG_NETTEST_SERVER=1 +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_HOST=1 +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_SERVER=1 \ + -DCONFIG_EXAMPLE_NETTEST_CLIENTIP="$(CONFIG_EXAMPLE_NETTEST_CLIENTIP)" endif HOST_SRCS = host.c -ifeq ($(CONFIG_NETTEST_SERVER),y) +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) HOST_SRCS += nettest-client.c else HOST_SRCS += nettest-server.c diff --git a/nuttx/examples/nettest/host.c b/nuttx/examples/nettest/host.c index 0d59b1abf..8b0bffd7d 100644 --- a/nuttx/examples/nettest/host.c +++ b/nuttx/examples/nettest/host.c @@ -53,7 +53,7 @@ int main(int argc, char **argv, char **envp) { -#ifdef CONFIG_NETTEST_SERVER +#ifdef CONFIG_EXAMPLE_NETTEST_SERVER send_client(); #else recv_server(); diff --git a/nuttx/examples/nettest/nettest-client.c b/nuttx/examples/nettest/nettest-client.c index a38ff0049..cb086059c 100644 --- a/nuttx/examples/nettest/nettest-client.c +++ b/nuttx/examples/nettest/nettest-client.c @@ -57,12 +57,12 @@ void send_client(void) { struct sockaddr_in myaddr; char outbuf[SENDSIZE]; -#ifndef CONFIG_NETTEST_PERFORMANCE +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE char inbuf[SENDSIZE]; #endif int sockfd; int nbytessent; -#ifndef CONFIG_NETTEST_PERFORMANCE +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE int nbytesrecvd; #endif int ch; @@ -107,7 +107,7 @@ void send_client(void) } } -#ifdef CONFIG_NETTEST_PERFORMANCE +#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE /* Then receive messages forever */ for (;;) diff --git a/nuttx/examples/nettest/nettest-server.c b/nuttx/examples/nettest/nettest-server.c index 98b1cc98f..d00498f4e 100644 --- a/nuttx/examples/nettest/nettest-server.c +++ b/nuttx/examples/nettest/nettest-server.c @@ -63,7 +63,7 @@ void recv_server(void) int acceptsd; socklen_t addrlen; int nbytesread; -#ifndef CONFIG_NETTEST_PERFORMANCE +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE int totalbytesread; int nbytessent; int ch; @@ -133,7 +133,7 @@ void recv_server(void) } #endif -#ifdef CONFIG_NETTEST_PERFORMANCE +#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE /* Then receive data forever */ for (;;) @@ -194,7 +194,7 @@ void recv_server(void) } } -#ifdef CONFIG_NETTEST_HOST +#ifdef CONFIG_EXAMPLE_NETTEST_HOST /* At present, data received by the target before it is completed the * the write opertion and started the read operation results in a failure * (the data is not received, but it is ACKed). This will have to be diff --git a/nuttx/examples/nettest/nettest.c b/nuttx/examples/nettest/nettest.c index c015696f1..1a6a59047 100644 --- a/nuttx/examples/nettest/nettest.c +++ b/nuttx/examples/nettest/nettest.c @@ -94,7 +94,7 @@ int user_start(int argc, char *argv[]) addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_NETMASK); uip_setnetmask("eth0", &addr); -#ifdef CONFIG_NETTEST_SERVER +#ifdef CONFIG_EXAMPLE_NETTEST_SERVER recv_server(); #else send_client(); diff --git a/nuttx/examples/nettest/nettest.h b/nuttx/examples/nettest/nettest.h index 9fe735911..eb7c83c84 100644 --- a/nuttx/examples/nettest/nettest.h +++ b/nuttx/examples/nettest/nettest.h @@ -40,7 +40,7 @@ * Included Files ****************************************************************************/ -#ifdef CONFIG_NETTEST_HOST +#ifdef CONFIG_EXAMPLE_NETTEST_HOST #else # include <debug.h> #endif @@ -49,7 +49,7 @@ * Definitions ****************************************************************************/ -#ifdef CONFIG_NETTEST_HOST +#ifdef CONFIG_EXAMPLE_NETTEST_HOST /* HTONS/L macros are unique to uIP */ # define HTONS(a) htons(a) |