read from socket gives different output when blocking/nonblocking
Björnke von Gierke
bvg at mac.com
Sat Sep 20 18:39:51 EDT 2003
I am trying to do a little irc application. For this I made a small
stack which can connect to a server and then send the login
information. The question that I have is this: Is this a bug and if no
what am I doing wrong?
My test server is efnet.demon.co.uk i am connecting on port 6666. A
typical conversation using blocking read's would be like this:
connection
the server sends me three lines with the end of line delimiter crlf:
NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Found your hostname
I send my authentication strings:
PASS
NICK Bjoernke
USER guest 0 bar :Bjoernke von Gierke
And so on
but when I do this whit a nonblocking read, i get this:
connection
the server sends me three lines with the end of line delimiter crlf:
efnet.demon.co.uk:6666
efnet.demon.co.uk:6666
efnet.demon.co.uk:6666
Now I would send my authentication, but its kinda senseless, as I am
unable to get any useful data.
the code I use:
--blocking
on mouseUp
read from socket field "server" until crlf
put it & return after field "log"
end mouseUp
--nonblocking
on mouseUp
read from socket field "server" until crlf with message "finished"
end mouseUp
on finished theMessage
put theMessage & return after field "log"
end finished
More information about the use-livecode
mailing list