Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

udpclient.c

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /* This file has been written by Sergio Perez Alcañiz <serpeal@disca.upv.es>  */
00003 /*            Departamento de Informática de Sistemas y Computadores          */
00004 /*            Universidad Politécnica de Valencia                             */
00005 /*            Valencia (Spain)                                                */
00006 /******************************************************************************/
00007 
00008 #include <linux/module.h>
00009 #include <linux/kernel.h>
00010 #include "lwip/ip_addr.h"
00011 #include "lwip/api.h"
00012 #include "lwip/sys.h"
00013 #include <rtl_sched.h>
00014 
00015 void *status;
00016 static struct netconn *conn;
00017 static struct netbuf *buf;
00018 struct ip_addr ipaddr;
00019 char buffer[5];
00020 
00021 static void udpclient(void *arg){
00022 
00023   IP4_ADDR(&ipaddr, 158,42,58,139);
00024   
00025   conn = netconn_new(NETCONN_UDP);
00026   netconn_connect(conn, &ipaddr, 7);
00027 
00028   buffer[0]='h';
00029   buffer[1]='o';
00030   buffer[2]='l';
00031   buffer[3]='a';
00032   buffer[4]='\0';
00033 
00034   buf=netbuf_new();
00035   
00036   netbuf_ref(buf,&buffer,sizeof(buffer));
00037   netconn_send(conn,buf);
00038 
00039   rtl_printf(" UDP CLient sending %s\n", buffer);
00040 
00041   sys_thread_exit();
00042 }
00043 
00044 
00045 /*-----------------------------------------------------------------------------------*/
00046 int init_module(void){
00047   printk("\n\n UDP echo client module inserted\n\n"); 
00048   sys_thread_new(udpclient, NULL, 0);
00049  return 0;
00050 }
00051 
00052 /*-----------------------------------------------------------------------------------*/
00053 void cleanup_module(void){
00054   printk("\n UDP echo client module removed\n");
00055 }

Generated on Wed Jan 14 12:58:57 2004 for RTL-lwIP-0.4 by doxygen 1.3.4