#include <linux/module.h>
#include <linux/kernel.h>
#include "lwip/ip_addr.h"
#include "lwip/sys.h"
#include "lwip/api.h"
#include <rtl_sched.h>
Include dependency graph for tcpclient.c:
Go to the source code of this file.
Functions | |
void * | tcp_client (void *arg) |
int | init_module (void) |
void | cleanup_module (void) |
Variables | |
pthread_t | rtl_lwip_tcpclient |
|
Definition at line 73 of file tcpclient.c. References rtl_lwip_tcpclient.
00073 {
00074 pthread_delete_np(rtl_lwip_tcpclient);
00075 printk("\n\nEcho TCP client module removed.\n\n");
00076 }
|
|
Definition at line 57 of file tcpclient.c. References NULL, rtl_lwip_tcpclient, and tcp_client().
00057 { 00058 pthread_attr_t attr; 00059 00060 printk("\n\nEcho TCP client module inserted.\n\n"); 00061 00062 pthread_attr_init(&attr); 00063 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 00064 if(pthread_create(&(rtl_lwip_tcpclient),&attr, tcp_client, NULL)) { 00065 rtl_printf("ERROR: cannot create pthread!\n"); 00066 return -1; 00067 } 00068 00069 return 0; 00070 } |
Here is the call graph for this function:
|
Definition at line 19 of file tcpclient.c. References conn, data, IP4_ADDR, ipaddr, netconn_bind(), netconn_connect(), NETCONN_COPY, netconn_delete(), netconn_new(), NETCONN_TCP, netconn_write(), sys_thread_exit(), and sys_thread_register(). Referenced by init_module().
00019 { 00020 static struct netconn *conn; 00021 struct ip_addr ipaddr; 00022 char data[6]; 00023 00024 sys_thread_register((void *) pthread_self()); 00025 00026 rtl_printf("TCP Client thread : 0x%x\n",pthread_self()); 00027 00028 conn = netconn_new(NETCONN_TCP); 00029 00030 IP4_ADDR(&ipaddr, 158,42,58,141); 00031 00032 netconn_bind(conn, &ipaddr, 7); 00033 00034 IP4_ADDR(&ipaddr, 158,42,58,139); 00035 00036 rtl_printf("Netconn_connect\n"); 00037 netconn_connect(conn, &ipaddr, 10); 00038 00039 data[0] = 'h'; 00040 data[1] = 'e'; 00041 data[2] = 'l'; 00042 data[3] = 'l'; 00043 data[4] = 'o'; 00044 data[5] = '\0'; 00045 00046 rtl_printf("Echo TCP client sending: %s\n",data); 00047 00048 netconn_write(conn,data,6,NETCONN_COPY); 00049 00050 netconn_delete(conn); 00051 00052 return sys_thread_exit(); 00053 } |
Here is the call graph for this function:
|
Definition at line 16 of file tcpclient.c. Referenced by cleanup_module(), and init_module(). |