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