| 1 |
|
| 2 |
CHARGEN |
| 3 |
|
| 4 |
This file implements a nice example of handling multiple tcp sockets in a |
| 5 |
server environment. Just call chargen_init() from your application after |
| 6 |
you have initialized lwip and added your network interfaces. Change the |
| 7 |
MAX_SERV option to increase or decrease the number of sessions supported. |
| 8 |
|
| 9 |
chargen will jam as much data as possible into the output socket, so it |
| 10 |
will take up a lot of CPU time. Therefore it will be a good idea to run it |
| 11 |
as the lowest possible priority (just ahead of any idle task). |
| 12 |
|
| 13 |
This is also a good example of how to support multiple sessions in an |
| 14 |
embedded system where you might not have fork(). The multiple sessions are |
| 15 |
all handled by the same thread and select() is used for demultiplexing. |
| 16 |
|
| 17 |
No makefile is provided, just add chargen to the makefile for your |
| 18 |
application. It is OS and HW independent. |
| 19 |
|
| 20 |
Once the chargen server is running in your application, go to another system |
| 21 |
and open a telnet session to your lwip platform at port 19. You should see an |
| 22 |
ASCII pattern start to stream on you screen. |
| 23 |
|
| 24 |
As an example, lets say that your system running lwip is at IP address |
| 25 |
192.168.10.244 and you have a linux system connected to it at IP address |
| 26 |
192.168.10.59. Issue the following command at a terminal prompt on the linux system: |
| 27 |
|
| 28 |
telnet 192.168.10.244 19 |
| 29 |
|
| 30 |
You will see a pattern similar to the following on streaming by on your |
| 31 |
screen: |
| 32 |
|
| 33 |
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ |
| 34 |
BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{| |
| 35 |
CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} |
| 36 |
DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ |
| 37 |
EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~! |
| 38 |
FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!" |
| 39 |
GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"# |
| 40 |
HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$ |
| 41 |
IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$% |
| 42 |
JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%& |
| 43 |
KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&' |
| 44 |
LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'( |
| 45 |
|
| 46 |
It even works from windows: At a dos prompt you can also issue the same |
| 47 |
telnet command and you will get a similar (but much slower, at least on W98) |
| 48 |
data stream. |
| 49 |
|
| 50 |
David Haas |
| 51 |
|
| 52 |
|