How can i check a response from a server? Ex: Say i log onto an SMTP server. I get this response: "220 SendMail v5.0 Ready" My program would say: "Helo localhost" The server would say: "250 Hello, pleased to meet you." Etc... So my question is how can i check for the 220 & 250??? That way, once the program has "seen" the response from the server, then it can continue on with the next part of the code. Know what i mean??? Any help is appreciated. Later for now. Thanks! Nok.
Posted on 2001-02-22 17:18:00 by Nokturnal
You can store received data in a buffer and every time data is added, check if the buffer contains a full line (CR, LF or CRLF terminated). If not, just wait for more data. If yes, examine the response code by taking the first three bytes from the buffer and then proceed with your code according to the response code (after you've deleted the line in the buffer). hope this helps, Thomas
Posted on 2001-02-22 17:23:00 by Thomas
Here's some code I used for my HTTP server, maybe it's of some use to you:

;ReceivedData db RECEIVEBUFFERSIZE dup (?)         Received data buffer
;CurrentBufferSize dd   ?          Current number of bytes in buffer

; ---- traces buffer for lines (CR/LF/CRLF) and calls a routine for every line ----
; ---- returns 1 on success ---
UpdateBuffer proc  uses edx ecx esi ebx
xor esi, esi
    mov edx, offset ReceivedData 
    mov ecx, edx
    add ecx, CurrentBufferSize
;---------- Scan for CR/LF------------
    .WHILE (edx
Posted on 2001-02-22 17:40:00 by Thomas
Great! Thanks Thomas!!! I owe ya one.
Posted on 2001-02-22 20:32:00 by Nokturnal