#include <linux/module.h>
#include <linux/kernel.h>
#include "lwip/sys.h"
#include "lwip/api.h"
#include <rtl_sched.h>
#include <rtl_debug.h>
Include dependency graph for tcpthreaded.c:
Go to the source code of this file.
Functions | |
void | serve_echo (void *arg) |
void | tcpecho_thread (void *arg) |
int | init_module (void) |
void | cleanup_module (void) |
|
Definition at line 77 of file tcpthreaded.c.
00077 {
00078 printk("\n Multithreaded TCP echo server removed\n");
00079 }
|
|
Definition at line 70 of file tcpthreaded.c. References NULL, sys_thread_new(), and tcpecho_thread().
00070 { 00071 printk("\n Multithreaded TCP echo server inserted\n"); 00072 sys_thread_new(tcpecho_thread, NULL, 0); 00073 return 0; 00074 } |
Here is the call graph for this function:
|
Definition at line 18 of file tcpthreaded.c. References data, len, netbuf_data(), netbuf_delete(), netbuf_next(), netconn_close(), netconn_delete(), netconn_recv(), newconn, NULL, sys_thread_exit(), and u16_t. Referenced by tcpecho_thread().
00019 { 00020 struct netconn *newconn; 00021 00022 /* Grab new connection. */ 00023 newconn = (struct netconn *) arg; //netconn_accept(conn); 00024 00025 rtl_printf("accepted new connection %p by thread 0x%x\n", newconn,(unsigned int)pthread_self()); 00026 00027 /* Process the new connection. */ 00028 if(newconn != NULL) { 00029 struct netbuf *buf; 00030 void *data; 00031 u16_t len; 00032 00033 while((buf = netconn_recv(newconn)) != NULL) { 00034 do { 00035 netbuf_data(buf, &data, &len); 00036 rtl_printf("Got : %s\n", data); 00037 } while(netbuf_next(buf) >= 0); 00038 netbuf_delete(buf); 00039 } 00040 00041 /* Close connection and discard connection identifier. */ 00042 netconn_close(newconn); 00043 netconn_delete(newconn); 00044 } 00045 sys_thread_exit(); 00046 } |
Here is the call graph for this function:
|
Definition at line 50 of file tcpthreaded.c. References conn, netconn_accept(), netconn_bind(), netconn_listen(), netconn_new(), NETCONN_TCP, NULL, serve_echo(), and sys_thread_new(). Referenced by init_module().
00051 { 00052 struct netconn *conn; 00053 00054 /* Create a new connection identifier. */ 00055 conn = netconn_new(NETCONN_TCP); 00056 00057 /* Bind connection to well known port number 7. */ 00058 netconn_bind(conn, NULL, 7); 00059 00060 /* Tell connection to go into listening mode. */ 00061 netconn_listen(conn); 00062 00063 while(1) { 00064 /* Grab new connection. */ 00065 sys_thread_new(serve_echo, netconn_accept(conn), 0); 00066 } 00067 } |
Here is the call graph for this function: