Merge pull request #789 from nvt/fix-psock-examples
Make the Protosockets examples possible to compile.
This commit is contained in:
commit
ad10f438c0
|
@ -1,10 +1,11 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
|
||||||
static struct psock ps;
|
static struct psock ps;
|
||||||
static char buffer[100];
|
static uint8_t buffer[100];
|
||||||
|
|
||||||
PROCESS(example_psock_client_process, "Example protosocket client");
|
PROCESS(example_psock_client_process, "Example protosocket client");
|
||||||
|
AUTOSTART_PROCESSES(&example_psock_client_process);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
|
@ -28,12 +29,10 @@ PROCESS_THREAD(example_psock_client_process, ev, data)
|
||||||
{
|
{
|
||||||
uip_ipaddr_t addr;
|
uip_ipaddr_t addr;
|
||||||
|
|
||||||
printf("%d\n", TEST);
|
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
uip_ipaddr(addr, 192,168,2,1);
|
uip_ipaddr(&addr, 192,168,2,1);
|
||||||
tcp_connect(addr, UIP_HTONS(80), NULL);
|
tcp_connect(&addr, UIP_HTONS(80), NULL);
|
||||||
|
|
||||||
printf("Connecting...\n");
|
printf("Connecting...\n");
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||||
|
|
|
@ -28,7 +28,7 @@ static struct psock ps;
|
||||||
* We must have somewhere to put incoming data, and we use a 10 byte
|
* We must have somewhere to put incoming data, and we use a 10 byte
|
||||||
* buffer for this purpose.
|
* buffer for this purpose.
|
||||||
*/
|
*/
|
||||||
static char buffer[10];
|
static uint8_t buffer[10];
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
|
@ -90,9 +90,10 @@ PT_THREAD(handle_connection(struct psock *p))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* We declare the process.
|
* We declare the process and specify that it should be automatically started.
|
||||||
*/
|
*/
|
||||||
PROCESS(example_psock_server_process, "Example protosocket server");
|
PROCESS(example_psock_server_process, "Example protosocket server");
|
||||||
|
AUTOSTART_PROCESSES(&example_psock_server_process);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* The definition of the process.
|
* The definition of the process.
|
||||||
|
|
Loading…
Reference in a new issue