[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] test af TCP client



David Bo Jensen wrote:
> Jeg har lavet en socket TCP klient, denne vil jeg gerne teste.
> Er der noget software, der virker som en server, hvor man manuelt f.eks kan 
> sende en fil, som svar på noget  man har modtaget fra min klient? 
>
>
>   
netcat og et shellscript kan gøre en del, men ellers må du måske ud i
noget Ruby/Python/Perl/Whatever. Et simpelt eksempel:

sslug@sslug:~$ cat client_test.sh
#!/bin/bash

again=1
while [ $again == 1 ]; do
    read x
    case $x in
        QUIT)
            again=0
            ;;
        *)
            if [ -f "$x" ]; then
                cat $x
            else
                echo "No such file: $x"
            fi
            ;;
    esac
done
sslug@sslug:~$ nc -e ./client_test.sh -l -p 5678

sslug@sslug:~$ nc -e ./client_test.sh -l -p 5678 &
[1] 6603
sslug@sslug:~$ nc localhost 5678
/etc/mtab
/dev/sda3 / ext3 rw,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
/sys /sys sysfs rw,noexec,nosuid,nodev 0 0
varrun /var/run tmpfs rw,noexec,nosuid,nodev,mode=0755 0 0
varlock /var/lock tmpfs rw,noexec,nosuid,nodev,mode=1777 0 0
udev /dev tmpfs rw,mode=0755 0 0
devshm /dev/shm tmpfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
lrm /lib/modules/2.6.22-14-generic/volatile tmpfs rw 0 0
/dev/sda2 /home ext3 rw 0 0
securityfs /sys/kernel/security securityfs rw 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
QUIT
[1]+  Done                    nc -e ./client_test.sh -l -p 5678
sslug@sslug:~$


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-12-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *