[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tkined
Subject:    [tkined] RE: How to sent \x00 and \xff using scotty UDP socket ?
From:       "Annie Chang" <cannie () cisco ! com>
Date:       2003-02-21 0:44:14
[Download RAW message or body]

I am still waiting for any comments regarding this issue.

I need to write a tftp client using TCL scotty extension.
Tftp server expect the first 2 bytes of the request line to be "\x0001" or
"\x0002"

I try to send the 2 bytes using TCL binary command "udp send $sock [ binary
format H4 0001 ]"  via a scotty UDP socket. However; it got translated into
'c08001'when the string went down to udp socket layer.  I am not sure if
this is a scotty bug or I did not code it correctly ( TCP socket works fine
though..)

I think the error happens only when sending "00" and "ff" other ascii text
is encoded correctly.

It would be helpful if anyone knows what's going on or where I can find a
tftp client example script in TCL/scotty.

Thanks a lot



-----Original Message-----
From: Annie Chang [mailto:cannie@cisco.com]
Sent: Thursday, February 20, 2003 11:15 AM
To: tkined@ibr.cs.tu-bs.de; testing-community@cisco.com
Subject: How to sent \x00 and \xff using scotty UDP socket ?


 I have problems sending hex "00" and "ff" using scotty udp socket.

I try sending the same strings using both tcp and udp socket in scotty
shell. TCP works fine, however; the 2 string got translated wrong when
sending by udp

binary format H* 00  ==> translated as 00 in tcp socket ,  c080 in udp
socket
binary format H* ff  ==> translated as ff in tcp socket ,  c3bf in udp
socket


Thanks

#### sending hex code 00 using TCP
11:27:13.313175 r1.echo > annie.32876: P 1:4(3) ack 4 win 5792
<nop,nop,timestamp 136627782 8587329> (DF)
                         4500 0037 c0c2 4000 4006 e366 c0a8 0ae1
                         c0a8 0a66 0007 806c f9e2 0684 e966 6aa2
                         8018 16a0 135b 0000 0101 080a 0824 c646
                         0083 0841 000d 0a
                                   ^^ still 00 here

#### sending hex code 00 using UDP
11:27:13.333175 annie.32776 > r1.echo:  udp 4 (DF)
                         4500 0020 0843 4000 4011 9bf2 c0a8 0a66
                         c0a8 0ae1 8008 0007 000c 1ba4 c080 0d0a
                                                       ^^^^ 00 became c080!


### sending hex code ff using TCP
11:28:59.933175 r1.echo > annie.32877: P 1:4(3) ack 4 win 5792
<nop,nop,timestamp 136638445 8597991> (DF)
                         4500 0037 6c78 4000 4006 37b1 c0a8 0ae1
                         c0a8 0a66 0007 806d 0105 839b efb7 e394
                         8018 16a0 bd8e 0000 0101 080a 0824 efed
                         0083 31e7 ff0d 0a
                                   ^^ still ff here
### sending hex code ff using UDP
11:28:59.953175 annie.32776 > r1.echo:  udp 4 (DF)
                         4500 0020 31e9 4000 4011 724c c0a8 0a66
                         c0a8 0ae1 8008 0007 000c 1865 c3bf 0d0a
                                                       ^^^^ ==> ff became
c3bf !!!

########################################
##script used to test this
#########################################

set hex_code 00
set hex_code ff

### echo test using tcp socket ( works ok)
set s [ socket 192.168.10.225 echo ]
puts $s [binary format "H*" $hex_code]
flush $s
puts "tcp sent :<$hex_code>"
binary scan [ gets $s ] "H*" response
puts "tcp receive :<$response>"
close $s

## echo test using udp socket ( can't send 00, ff correctly)
set s [ udp connect 192.168.10.225 echo ]
udp send $s [binary format "H*" "${hex_code}0d0a" ]
puts "UDP sent :<$hex_code>"
binary scan [ udp receive $s ] "H*" response
puts "UDP receive :<$response>"
udp close $s

-- 
!! This message is brought to you via the `tkined' mailing list.
!! Please do not reply to this message to unsubscribe. To unsubscribe or adjust
!! your settings, send a mail message to <tkined-request@ibr.cs.tu-bs.de>
!! or look at https://www.ibr.cs.tu-bs.de/mailman/listinfo/tkined.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic