(net-receive) or (net-only-partially-receive)?
Posted: Sat Jan 28, 2006 4:01 pm
I'm confused as to why the following occurs:
netcat (nc):
telnet:
Now as you can see here, the content that is received is always different upon every connection. I could use netcat to connect over and over, and I would never receive the same results. This is expected behavior of the server. What confuses me, however, is the fact that the following code only receives what seems like a small portion of the stuff sent from the server.
And when I run that code:
I can run the program multiple times and still, I only appear to get a few results (as compared to that returned by a nc or telnet connection).
Can anyone tell me why this is the case? I should be seeing a little more than I am, so what if anything, am I doing incorrectly?
netcat (nc):
Code: Select all
# nc server 5842
%œŽ00ü›nßæ"ûO-^[[?1;2c
Code: Select all
# telnet server 5842
Connected to server.
Escape character is '^]'.
.m’Ww¢½MºÏŸjù©3
Code: Select all
(context 'MAIN)
(setq host "server")
(setq port 5842)
(setq socket (net-connect host port))
(if socket
(begin
(println "Connected successfully!")
(net-receive socket 'buffer 5128)
(if buffer
(println "Recieved: " buffer)
)
)
)
(net-close socket)
(exit)
Code: Select all
# ./code
Connected successfully!
Recieved: ¹«Õ/
Code: Select all
# ./code
Connected successfully!
Recieved: Žž»2
Code: Select all
# ./code
Connected successfully!
Recieved: BͲ
Code: Select all
# ./code
Connected successfully!
Recieved: {<