-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deno.connect failed to read full bytes #28547
Comments
FYI: I've edited the issue description to properly format the code snippets to make it easier to read. Using single backticks doesn't work well with code multiline code snippets. These are typically formatted with three backticks and a language specifier so that you get nice syntax highlighting. Example:
...looks like this: console.log("hey") You can learn more about how to format code on GitHub here https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks |
With const encoder = new TextEncoder();
const decoder = new TextDecoder();
// your code
const conn = await Deno.connect({ hostname: 'smtp.gmail.com', port: 25, tcp: 'tcp' });
const response = await send_response(conn, "EHLO mail.example.com\r\n");
console.log(response);
const response2 = await send_response(conn, "EHLO mail.example.com\r\n");
console.log(response2); I am receiving
More details may be necessary to replicate your issue. Is this the same server and port you're using? And what source are you getting the expected output from? Do you get the expected value when you connect to the SMTP server using a platform other than Deno? |
@WWRS you made twice call and the output are as expected., but it raises the uncertainty, the needed to call it once or twice or even more. |
Oh, I see the issue. When you
is loaded into the readable stream of
is loaded. If you haven't consumed the first chunk, it gets printed the first time you call const conn = await Deno.connect({ hostname: 'smtp.gmail.com', port: 587, tcp: 'tcp' });
const reader = conn.readable.getReader();
await reader.read(); // Consume the 220 chunk
reader.releaseLock();
const response = await send_response(conn, "EHLO mail.example.com\r\n");
console.log(response); will drop the first chunk and synchronize |
I got the point now, When connecting to smtp server the first thing to do is read the response instead of send "EHLO..." message; However, it should be noted that one on one message should be complied when making peer to peer communication. Otherwise, we should make a loop that will make the process take a longer time. Thanks anyway., |
@Srabutdotcom You can close the issue. |
Version: Deno 2.2.4
Expected output are:
"250-smtp.gmail.com at your servi.."
"250-SIZE 3..."
"....etc..."
but got only
"250-smtp.gmail.com at your servi.."
Here is my codes:
and
Appreciate for any suggestion;
The text was updated successfully, but these errors were encountered: