[Gambas-user] Problem with READ on a UDP socket

Gareth Bult gareth at ...1689...
Tue Nov 4 11:48:32 CET 2008


Hi, 

I think I reported this quite a while ago but it still seems to be a problem ... using READ to try to acquire less than the entire available buffer doesn't seem to work .. and if I read the entire buffer, there's no obvious way to break the packet down into it's constituent parts ... 

Anyone any ideas? 
(and anyone any idea where the other 24 bytes are going ??) 

PRIVATE $udp AS UdpSocket 

PUBLIC SUB _new() 

$udp = NEW UdpSocket AS "Socket" 
$udp.Bind(2000) 

END 

PUBLIC SUB Socket_Read() 

DIM cmd AS Byte 
DIM siz AS Long 

PRINT Lof($udp) 
READ #$udp, cmd, 1 
PRINT Lof($udp) 
'READ #$udp, siz, 8 <= generates error if uncommented 

END 

$shell> echo "R00000011Hello World 123" |nc -u localhost 2000 

25 
0 <=== "should be 24!" 



-- 
Managing Director, Encryptec Limited 
Tel: 0845 5082719, Mob: 0785 3305393 
Email: gareth at ...1689... 
Statements made are at all times subject to Encryptec's Terms and Conditions of Business, which are available upon request. 



More information about the User mailing list